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
PhiSymmetryCalibration_step2 Class Reference

#include <PhiSymmetryCalibration_step2.h>

Inheritance diagram for PhiSymmetryCalibration_step2:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob ()
 
void endJob ()
 
void fillConstantsHistos ()
 
void fillHistos ()
 
void outResidHistos ()
 
 PhiSymmetryCalibration_step2 (const edm::ParameterSet &iConfig)
 
void readEtSums ()
 
void setUp (const edm::EventSetup &setup)
 
void setupResidHistos ()
 
 ~PhiSymmetryCalibration_step2 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< DetIdbarrelCells
 
std::vector< TH2F * > correl_barl_histos
 
std::vector< TH2F * > correl_endc_histos
 
EcalGeomPhiSymHelper e_
 
std::vector< DetIdendcapCells
 
float epsilon_M_barl [kBarlRings][kBarlWedges][kSides]
 
float epsilon_M_endc [kEndcWedgesX][kEndcWedgesY][kSides]
 
double esum_barl_ [kBarlRings][kBarlWedges][kSides]
 
double esum_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
double esumMean_barl_ [kBarlRings]
 
double esumMean_endc_ [kEndcEtaRings]
 
double etsum_barl_ [kBarlRings][kBarlWedges][kSides]
 
double etsum_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsum_endc_uncorr [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsumMean_barl_ [kBarlRings]
 
double etsumMean_endc_ [kEndcEtaRings]
 
bool firstpass_
 
bool have_initial_miscalib_
 
std::string initialmiscalibfile_
 
double k_barl_ [kBarlRings]
 
double k_endc_ [kEndcEtaRings]
 
std::vector< TH1F * > miscal_resid_barl_histos
 res miscalib histos More...
 
std::vector< TH1F * > miscal_resid_endc_histos
 
EcalIntercalibConstants miscalib_
 initial miscalibration applied if any) More...
 
EcalIntercalibConstants newCalibs_
 calib constants that we are going to calculate More...
 
unsigned int nhits_barl_ [kBarlRings][kBarlWedges][kSides]
 
unsigned int nhits_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
std::string oldcalibfile_
 
EcalIntercalibConstants oldCalibs_
 the old calibration constants (when reiterating, the last ones derived) More...
 
float rawconst_barl [kBarlRings][kBarlWedges][kSides]
 
float rawconst_endc [kEndcWedgesX][kEndcWedgesX][kSides]
 
bool reiteration_
 
int statusThreshold_
 

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 12 of file PhiSymmetryCalibration_step2.h.

Constructor & Destructor Documentation

PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2 ( const edm::ParameterSet iConfig)

Definition at line 26 of file PhiSymmetryCalibration_step2.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

26  {
27 
29  iConfig.getUntrackedParameter<int>("statusThreshold",0);
31  iConfig.getUntrackedParameter<bool>("haveInitialMiscalib",false);
33  iConfig.getUntrackedParameter<std::string>("initialmiscalibfile",
34  "InitialMiscalib.xml");
36  iConfig.getUntrackedParameter<std::string>("oldcalibfile",
37  "EcalIntercalibConstants.xml");
38  reiteration_ = iConfig.getUntrackedParameter<bool>("reiteration",false);
39  firstpass_=true;
40 }
T getUntrackedParameter(std::string const &, T const &) const
PhiSymmetryCalibration_step2::~PhiSymmetryCalibration_step2 ( )

Definition at line 23 of file PhiSymmetryCalibration_step2.cc.

23 {}

Member Function Documentation

void PhiSymmetryCalibration_step2::analyze ( const edm::Event ev,
const edm::EventSetup se 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 42 of file PhiSymmetryCalibration_step2.cc.

43  {
44 
45  if (firstpass_) {
46  setUp(se);
47  firstpass_=false;
48  }
49 }
void setUp(const edm::EventSetup &setup)
void PhiSymmetryCalibration_step2::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file PhiSymmetryCalibration_step2.cc.

References kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, and jetcorrextractor::sign().

122  {
123 
124 
125  for (int ieta=0; ieta<kBarlRings; ieta++) {
126  for (int iphi=0; iphi<kBarlWedges; iphi++) {
127  for (int sign=0; sign<kSides; sign++) {
128  etsum_barl_[ieta][iphi][sign]=0.;
129  nhits_barl_[ieta][iphi][sign]=0;
130  esum_barl_[ieta][iphi][sign]=0.;
131 
132  }
133  }
134  }
135 
136  for (int ix=0; ix<kEndcWedgesX; ix++) {
137  for (int iy=0; iy<kEndcWedgesY; iy++) {
138  for (int sign=0; sign<kSides; sign++) {
139  etsum_endc_[ix][iy][sign]=0.;
140  nhits_endc_[ix][iy][sign]=0;
141  esum_endc_[ix][iy][sign]=0.;
142 
143  }
144  }
145  }
146 
147  readEtSums();
149 }
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
double sign(double x)
static const int kSides
static const int kBarlWedges
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcWedgesX
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double esum_barl_[kBarlRings][kBarlWedges][kSides]
double esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2::endJob ( void  )
virtual

this is the new constant, or better, the correction to be applied to the old constant

residual miscalibraition / expected precision

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file PhiSymmetryCalibration_step2.cc.

References funct::abs(), EcalCondHeader::datasource_, EcalCondHeader::date_, EBDetId::ieta(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, EcalCondHeader::method_, dbtoconf::out, relativeConstraints::ring, jetcorrextractor::sign(), EcalCondHeader::since_, AlCaHLTBitMon_QueryRunRegistry::string, EcalCondHeader::tag_, EcalCondHeader::version_, EcalFloatCondObjectContainerXMLTranslator::writeXML(), EBDetId::zside(), and EEDetId::zside().

151  {
152 
153  if (firstpass_) {
154  edm::LogError("PhiSym")<< "Must process at least one event-Exiting" <<endl;
155  return;
156 
157  }
158 
159  // Here the real calculation of constants happens
160 
161  // perform the area correction for endcap etsum
162  // NOT USED ANYMORE
163 
164 
165  for (int ix=0; ix<kEndcWedgesX; ix++) {
166  for (int iy=0; iy<kEndcWedgesY; iy++) {
167 
168  int ring = e_.endcapRing_[ix][iy];
169 
170  if (ring!=-1) {
171  for (int sign=0; sign<kSides; sign++) {
172  etsum_endc_uncorr[ix][iy][sign] = etsum_endc_[ix][iy][sign];
173  etsum_endc_[ix][iy][sign]*=e_.meanCellArea_[ring]/e_.cellArea_[ix][iy];
174  }
175  }
176  }
177  }
178 
179 
180  // ETsum histos, maps and other usefull histos (area,...)
181  // are filled and saved here
182  fillHistos();
183 
184  // write ETsum mean for all rings
185  std::ofstream etsumMean_barl_out("etsumMean_barl.dat",ios::out);
186  for (int ieta=0; ieta<kBarlRings; ieta++) {
187  etsumMean_barl_out << ieta << " " << etsumMean_barl_[ieta] << endl;
188  }
189  etsumMean_barl_out.close();
190 
191  std::ofstream etsumMean_endc_out("etsumMean_endc.dat",ios::out);
192  for (int ring=0; ring<kEndcEtaRings; ring++) {
193  etsumMean_endc_out << e_.cellPos_[ring][50].eta() << " " << etsumMean_endc_[ring] << endl;
194  }
195  etsumMean_endc_out.close();
196 
197 
198  // determine barrel calibration constants
199  for (int ieta=0; ieta<kBarlRings; ieta++) {
200  for (int iphi=0; iphi<kBarlWedges; iphi++) {
201  for (int sign=0; sign<kSides; sign++) {
202  if(e_.goodCell_barl[ieta][iphi][sign]){
203  float etsum = etsum_barl_[ieta][iphi][sign];
204  float epsilon_T = (etsum/etsumMean_barl_[ieta]) - 1.;
205  rawconst_barl[ieta][iphi][sign] = epsilon_T + 1.;
206  epsilon_M_barl[ieta][iphi][sign] = epsilon_T/k_barl_[ieta];
207  } else {
208  rawconst_barl[ieta][iphi][sign] = 1.;
209  epsilon_M_barl[ieta][iphi][sign] = 0.;
210  } //if
211  } //sign
212  } //iphi
213  } //ieta
214 
215  // determine endcap calibration constants
216  for (int ix=0; ix<kEndcWedgesX; ix++) {
217  for (int iy=0; iy<kEndcWedgesY; iy++) {
218  for (int sign=0; sign<kSides; sign++) {
219  int ring = e_.endcapRing_[ix][iy];
220  if (ring!=-1 && e_.goodCell_endc[ix][iy][sign]) {
221  float etsum = etsum_endc_[ix][iy][sign];
222  float epsilon_T = (etsum/etsumMean_endc_[ring]) - 1.;
223  rawconst_endc[ix][iy][sign] = epsilon_T + 1.;
224  epsilon_M_endc[ix][iy][sign] = epsilon_T/k_endc_[ring];
225  } else {
226  epsilon_M_endc[ix][iy][0] = 0.;
227  epsilon_M_endc[ix][iy][1] = 0.;
228  rawconst_endc[ix][iy][0] = 1.;
229  rawconst_endc[ix][iy][1] = 1.;
230  } //if
231  } //sign
232  } //iy
233  } //ix
234 
235 
236 
237  std::string newcalibfile("EcalIntercalibConstants_new.xml");
238 
239 
240 
241  TFile ehistof("ehistos.root","recreate");
242 
243  TH1D ebhisto("eb","eb",100, 0.,2.);
244 
245  std::vector<DetId>::const_iterator barrelIt=barrelCells.begin();
246  for (; barrelIt!=barrelCells.end(); barrelIt++) {
247  EBDetId eb(*barrelIt);
248  int ieta = abs(eb.ieta())-1;
249  int iphi = eb.iphi()-1;
250  int sign = eb.zside()>0 ? 1 : 0;
251 
254  newCalibs_[eb] = oldCalibs_[eb]/(1+epsilon_M_barl[ieta][iphi][sign]);
255 
256  if(e_.goodCell_barl[ieta][iphi][sign]){
257 
258  ebhisto.Fill(newCalibs_[eb]);
259 
261  miscal_resid_barl_histos[ieta]->Fill(miscalib_[eb]*newCalibs_[eb]);
262  correl_barl_histos[ieta]->Fill(miscalib_[eb],newCalibs_[eb]);
263 
264  }
265 
266  }// barrelit
267 
268  TH1D eehisto("ee","ee",100, 0.,2.);
269  std::vector<DetId>::const_iterator endcapIt=endcapCells.begin();
270 
271  for (; endcapIt!=endcapCells.end(); endcapIt++) {
272  EEDetId ee(*endcapIt);
273  int ix = ee.ix()-1;
274  int iy = ee.iy()-1;
275  int sign = ee.zside()>0 ? 1 : 0;
276 
277  newCalibs_[ee] = oldCalibs_[ee]/(1+epsilon_M_endc[ix][iy][sign]);
278 
279 
280  if(e_.goodCell_endc[ix][iy][sign]){
281 
282  eehisto.Fill(newCalibs_[ee]);
284  newCalibs_[ee]);;
285 
286  correl_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee],
287  newCalibs_[ee]);
288 
289  }
290  }//endcapit
291  // Write xml file
292  EcalCondHeader header;
293  header.method_="phi symmetry";
294  header.version_="0";
295  header.datasource_="testdata";
296  header.since_=1;
297  header.tag_="unknown";
298  header.date_="Mar 24 1973";
299 
301  newCalibs_ );
302 
303  eehisto.Write();
304  ebhisto.Write();
305  ehistof.Close();
306 
308 
309  outResidHistos();
310 
311  // finally output global etsums
312  std::fstream ebf("etsummary_barl.dat",ios::out);
313  std::fstream eef("etsummary_endc.dat",ios::out);
314 
315  for (int ieta=0; ieta<kBarlRings; ieta++) {
316  for (int iphi=0; iphi<kBarlWedges; iphi++) {
317  for (int sign=0; sign<kSides; sign++) {
318 
319  ebf<< ieta<< " " << iphi << " " <<sign <<" "
320  << etsum_barl_[ieta][iphi][sign]<<endl;
321 
322  }
323  }
324  }
325 
326  for (int ix=0; ix<kEndcWedgesX; ix++) {
327  for (int iy=0; iy<kEndcWedgesY; iy++) {
328  for (int sign=0; sign<kSides; sign++) {
329  eef<<ix<<" " <<iy<<" " <<sign<<" "
330  << etsum_endc_[ix][iy][sign]<<endl;
331 
332 
333  }
334  }
335  }
336 
337 }
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
std::string datasource_
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
cond::Time_t since_
std::string date_
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
double sign(double x)
std::string version_
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
static const int kSides
float epsilon_M_endc[kEndcWedgesX][kEndcWedgesY][kSides]
float epsilon_M_barl[kBarlRings][kBarlWedges][kSides]
static const int kBarlWedges
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcWedgesX
float rawconst_barl[kBarlRings][kBarlWedges][kSides]
double etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const int kEndcEtaRings
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
std::vector< TH1F * > miscal_resid_endc_histos
std::string tag_
tuple out
Definition: dbtoconf.py:99
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
std::string method_
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
T eta() const
Definition: PV3DBase.h:76
EcalIntercalibConstants newCalibs_
calib constants that we are going to calculate
double meanCellArea_[kEndcEtaRings]
double cellArea_[kEndcWedgesX][kEndcWedgesY]
float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2::fillConstantsHistos ( )

Definition at line 342 of file PhiSymmetryCalibration_step2.cc.

References f, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, jetcorrextractor::sign(), and EEDetId::validDetId().

342  {
343 
344  TFile f("CalibHistos.root","recreate");
345 
346  TH2F barreletamap("barreletamap","barreletamap",171, -85,86,100,0.,2.);
347  TH2F barreletamapraw("barreletamapraw","barreletamapraw",171, -85,86,100,0.,2.);
348 
349  TH2F barrelmapold("barrelmapold","barrelmapold",360,1.,361.,171,-85.,86.);
350  TH2F barrelmapnew("barrelmapnew","barrelmapnew",360,1.,361.,171,-85.,86.);
351  TH2F barrelmapratio("barrelmapratio","barrelmapratio",360,1.,361.,171,-85.,86.);
352 
353  TH1F rawconst_endc_h("rawconst_endc","rawconst_endc",100,0.,2.);
354  TH1F const_endc_h("const_endc","const_endc",100,0.,2.);
355 
356  TH1F oldconst_endc_h("oldconst_endc","oldconst_endc;oldCalib;",200,0,2);
357  TH2F newvsraw_endc_h("newvsraw_endc","newvsraw_endc;rawConst;newCalib",200,0,2,200,0,2);
358 
359  TH2F endcapmapold_plus("endcapmapold_plus","endcapmapold_plus",100,1.,101.,100,1.,101.);
360  TH2F endcapmapnew_plus("endcapmapnew_plus","endcapmapnew_plus",100,1.,101.,100,1.,101.);
361  TH2F endcapmapratio_plus("endcapmapratio_plus","endcapmapratio_plus",100,1.,101.,100,1.,101.);
362 
363  TH2F endcapmapold_minus("endcapmapold_minus","endcapmapold_minus",100,1.,101.,100,1.,101.);
364  TH2F endcapmapnew_minus("endcapmapnew_minus","endcapmapnew_minus",100,1.,101.,100,1.,101.);
365  TH2F endcapmapratio_minus("endcapmapratio_minus","endcapmapratio_minus",100,1.,101.,100,1.,101.);
366 
367 
368  for (int sign=0; sign<kSides; sign++) {
369 
370  int thesign = sign==1 ? 1:-1;
371 
372  for (int ieta=0; ieta<kBarlRings; ieta++) {
373  for (int iphi=0; iphi<kBarlWedges; iphi++) {
374  if(e_.goodCell_barl[ieta][iphi][sign]){
375 
376  EBDetId eb(thesign*( ieta+1 ), iphi+1);
377  //int mod20= (iphi+1)%20;
378  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
379  barreletamap.Fill(ieta*thesign + thesign,newCalibs_[eb]);
380  barreletamapraw.Fill(ieta*thesign + thesign,rawconst_barl[ieta][iphi][sign]);
381 
382  barrelmapold.Fill(iphi+1,ieta*thesign + thesign, oldCalibs_[eb]);
383  barrelmapnew.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]);
384  barrelmapratio.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]/oldCalibs_[eb]);
385  }//if
386  }//iphi
387  }//ieta
388 
389  for (int ix=0; ix<kEndcWedgesX; ix++) {
390  for (int iy=0; iy<kEndcWedgesY; iy++) {
391  if (e_.goodCell_endc[ix][iy][sign]){
392  if (! EEDetId::validDetId(ix+1, iy+1,thesign)) continue;
393  EEDetId ee(ix+1, iy+1,thesign);
394 
395  rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
396  const_endc_h.Fill(newCalibs_[ee]);
397  oldconst_endc_h.Fill(oldCalibs_[ee]);
398  newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign],newCalibs_[ee]);
399 
400  if(sign==1){
401  endcapmapold_plus.Fill(ix+1,iy+1,oldCalibs_[ee]);
402  endcapmapnew_plus.Fill(ix+1,iy+1,newCalibs_[ee]);
403  endcapmapratio_plus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
404  }
405  else{
406  endcapmapold_minus.Fill(ix+1,iy+1,oldCalibs_[ee]);
407  endcapmapnew_minus.Fill(ix+1,iy+1,newCalibs_[ee]);
408  endcapmapratio_minus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
409  }
410 
411  }//if
412  }//iy
413  }//ix
414 
415  } // sides
416 
417  barreletamap.Write();
418  barreletamapraw.Write();
419  rawconst_endc_h.Write();
420  const_endc_h.Write();
421  oldconst_endc_h.Write();
422  newvsraw_endc_h.Write();
423  barrelmapold.Write();
424  barrelmapnew.Write();
425  barrelmapratio.Write();
426  endcapmapold_plus.Write();
427  endcapmapnew_plus.Write();
428  endcapmapratio_plus.Write();
429  endcapmapold_minus.Write();
430  endcapmapnew_minus.Write();
431  endcapmapratio_minus.Write();
432 
433  f.Close();
434 }
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
double sign(double x)
static const int kSides
static const int kBarlWedges
static const int kEndcWedgesX
float rawconst_barl[kBarlRings][kBarlWedges][kSides]
double f[11][100]
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalIntercalibConstants newCalibs_
calib constants that we are going to calculate
float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2::fillHistos ( )

Definition at line 446 of file PhiSymmetryCalibration_step2.cc.

References f, kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, relativeConstraints::ring, jetcorrextractor::sign(), and tree::t.

447 {
448  TFile f("PhiSymmetryCalibration.root","recreate");
449 
450  std::vector<TH1F*> etsum_barl_histos(kBarlRings);
451  std::vector<TH1F*> esum_barl_histos(kBarlRings);
452 
453  // determine ranges of ET sums to get histo bounds and book histos (barrel)
454  for (int ieta=0; ieta<kBarlRings; ieta++) {
455  float low=999999.;
456  float high=0.;
457  float low_e=999999.;
458  float high_e=0.;
459 
460  for (int iphi=0; iphi<kBarlWedges; iphi++) {
461  for (int sign=0; sign<kSides; sign++) {
462  float etsum = etsum_barl_[ieta][iphi][sign];
463  if (etsum<low && etsum!=0.) low=etsum;
464  if (etsum>high) high=etsum;
465 
466  float esum = esum_barl_[ieta][iphi][sign];
467  if (esum<low_e && esum!=0.) low_e=esum;
468  if (esum>high_e) high_e=esum;
469  }
470  }
471 
472  ostringstream t;
473  t << "etsum_barl_" << ieta+1;
474  etsum_barl_histos[ieta]=new TH1F(t.str().c_str(),"",50,low-.2*low,high+.1*high);
475  t.str("");
476 
477  t << "esum_barl_" << ieta+1;
478  esum_barl_histos[ieta]=new TH1F(t.str().c_str(),"",50,low_e-.2*low_e,high_e+.1*high_e);
479  t.str("");
480 
481  // fill barrel ET sum histos
482  etsumMean_barl_[ieta]=0.;
483  esumMean_barl_[ieta]=0.;
484  for (int iphi=0; iphi<kBarlWedges; iphi++) {
485  for (int sign=0; sign<kSides; sign++) {
486  if(e_.goodCell_barl[ieta][iphi][sign]){
487  float etsum = etsum_barl_[ieta][iphi][sign];
488  float esum = esum_barl_[ieta][iphi][sign];
489  etsum_barl_histos[ieta]->Fill(etsum);
490  esum_barl_histos[ieta]->Fill(esum);
491  etsumMean_barl_[ieta]+=etsum;
492  esumMean_barl_[ieta]+=esum;
493  }
494  }
495  }
496 
497  etsum_barl_histos[ieta]->Write();
498  esum_barl_histos[ieta]->Write();
499  etsumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
500  esumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
501  delete etsum_barl_histos[ieta];
502  delete esum_barl_histos[ieta]; //VS
503  }
504 
505 
506  std::vector<TH1F*> etsum_endc_histos(kEndcEtaRings);
507  std::vector<TH1F*> etsum_endc_uncorr_histos(kEndcEtaRings);
508  std::vector<TH1F*> esum_endc_histos(kEndcEtaRings);
509 
510  std::vector<TH2F*> etsumvsarea_endc_histos(kEndcEtaRings);
511  std::vector<TH2F*> esumvsarea_endc_histos(kEndcEtaRings);
512 
513  // determine ranges of ET sums to get histo bounds and book histos (endcap)
514  for (int ring=0; ring<kEndcEtaRings; ring++) {
515 
516  float low=FLT_MAX;
517  float low_uncorr=FLT_MAX;
518  float high=0.;
519  float high_uncorr=0;
520  float low_e=FLT_MAX;
521  float high_e=0.;
522  float low_a=1.;
523  float high_a=0.;
524  for (int ix=0; ix<kEndcWedgesX; ix++) {
525  for (int iy=0; iy<kEndcWedgesY; iy++) {
526  if (e_.endcapRing_[ix][iy]==ring) {
527  for (int sign=0; sign<kSides; sign++) {
528  float etsum = etsum_endc_[ix][iy][sign];
529  if (etsum<low && etsum!=0.) low=etsum;
530  if (etsum>high) high=etsum;
531 
532  float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
533  if (etsum_uncorr<low_uncorr && etsum_uncorr!=0.) low_uncorr=etsum_uncorr;
534  if (etsum_uncorr>high_uncorr) high_uncorr=etsum_uncorr;
535 
536  float esum = esum_endc_[ix][iy][sign];
537  if (esum<low_e && esum!=0.) low_e=esum;
538  if (esum>high_e) high_e=esum;
539 
540  float area = e_.cellArea_[ix][iy];
541  if (area<low_a) low_a=area;
542  if (area>high_a) high_a=area;
543  }
544  }
545  }
546  }
547 
548  ostringstream t;
549  t<<"etsum_endc_" << ring+1;
550  etsum_endc_histos[ring]= new TH1F(t.str().c_str(),"",50,low-.2*low,high+.1*high);
551  t.str("");
552 
553  t<<"etsum_endc_uncorr_" << ring+1;
554  etsum_endc_uncorr_histos[ring]= new TH1F(t.str().c_str(),"",50,low_uncorr-.2*low_uncorr,high_uncorr+.1*high_uncorr);
555  t.str("");
556 
557  t<<"esum_endc_" << ring+1;
558  esum_endc_histos[ring]= new TH1F(t.str().c_str(),"",50,low_e-.2*low_e,high_e+.1*high_e);
559  t.str("");
560 
561  t<<"etsumvsarea_endc_" << ring+1;
562  etsumvsarea_endc_histos[ring]= new TH2F(t.str().c_str(),";A_{#eta#phi};#Sigma E_{T}",50,low_a,high_a,50,low,high);
563  t.str("");
564 
565  t<<"esumvsarea_endc_" << ring+1;
566  esumvsarea_endc_histos[ring]= new TH2F(t.str().c_str(),";A_{#eta#phi};#Sigma E",50,low_a,high_a,50,low_e,high_e);
567  t.str("");
568 
569  // fill endcap ET sum histos
570  etsumMean_endc_[ring]=0.;
571  esumMean_endc_[ring]=0.;
572  for (int ix=0; ix<kEndcWedgesX; ix++) {
573  for (int iy=0; iy<kEndcWedgesY; iy++) {
574  if (e_.endcapRing_[ix][iy]==ring) {
575  for (int sign=0; sign<kSides; sign++) {
576  if(e_.goodCell_endc[ix][iy][sign]){
577  float etsum = etsum_endc_[ix][iy][sign];
578  float esum = esum_endc_[ix][iy][sign];
579  float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
580  etsum_endc_histos[ring]->Fill(etsum);
581  etsum_endc_uncorr_histos[ring]->Fill(etsum_uncorr);
582  esum_endc_histos[ring]->Fill(esum);
583 
584  float area = e_.cellArea_[ix][iy];
585  etsumvsarea_endc_histos[ring]->Fill(area,etsum);
586  esumvsarea_endc_histos[ring]->Fill(area,esum);
587 
588  etsumMean_endc_[ring]+=etsum;
589  esumMean_endc_[ring]+=esum;
590  }
591  }
592  }
593  }
594  }
595 
596  etsum_endc_histos[ring]->Write();
597  etsum_endc_uncorr_histos[ring]->Write();
598  esum_endc_histos[ring]->Write();
599  etsumMean_endc_[ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
600  esumMean_endc_[ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
601  etsumvsarea_endc_histos[ring]->Write();
602  esumvsarea_endc_histos[ring]->Write();
603 
604  delete etsum_endc_histos[ring];
605  delete etsum_endc_uncorr_histos[ring];
606  delete esum_endc_histos[ring];
607  delete etsumvsarea_endc_histos[ring];
608  delete esumvsarea_endc_histos[ring];
609  }//ring
610 
611 
612  // Maps of etsum in EB and EE
613  TH2F barreletamap("barreletamap","barreletamap",171, -85,86,100,0,2);
614  TH2F barrelmap("barrelmap","barrelmap - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{0}}",360,1,360, 171, -85,86);
615  TH2F barrelmap_e("barrelmape","barrelmape - #frac{#Sigma E}{<#Sigma E>_{0}}",360,1,360, 171, -85,86);
616  TH2F barrelmap_divided("barrelmapdiv","barrelmapdivided - #frac{#Sigma E_{T}}{hits}",360,1,360,171,-85,86);
617  TH2F barrelmap_e_divided("barrelmapediv","barrelmapedivided - #frac{#Sigma E}{hits}",360,1,360,171,-85,86);
618  TH2F endcmap_plus_corr("endcapmapplus_corrected","endcapmapplus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
619  TH2F endcmap_minus_corr("endcapmapminus_corrected","endcapmapminus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
620  TH2F endcmap_plus_uncorr("endcapmapplus_uncorrected","endcapmapplus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
621  TH2F endcmap_minus_uncorr("endcapmapminus_uncorrected","endcapmapminus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
622  TH2F endcmap_e_plus("endcapmapeplus","endcapmapeplus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
623  TH2F endcmap_e_minus("endcapmapeminus","endcapmapeminus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
624 
625  for (int sign=0; sign<kSides; sign++) {
626 
627  int thesign = sign==1 ? 1:-1;
628 
629  for (int ieta=0; ieta<kBarlRings; ieta++) {
630  for (int iphi=0; iphi<kBarlWedges; iphi++) {
631  if(e_.goodCell_barl[ieta][iphi][sign]){
632  barrelmap.Fill(iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
633  barrelmap_e.Fill(iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/esumMean_barl_[0]); //VS
634  if (!nhits_barl_[ieta][iphi][sign]) nhits_barl_[ieta][iphi][sign] =1;
635  barrelmap_divided.Fill( iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
636  barrelmap_e_divided.Fill( iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]); //VS
637  //int mod20= (iphi+1)%20;
638  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
639  barreletamap.Fill(ieta*thesign + thesign,etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
640  }//if
641  }//iphi
642  }//ieta
643 
644  for (int ix=0; ix<kEndcWedgesX; ix++) {
645  for (int iy=0; iy<kEndcWedgesY; iy++) {
646  if (sign==1) {
647  endcmap_plus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
648  endcmap_plus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
649  endcmap_e_plus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
650  }
651  else{
652  endcmap_minus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
653  endcmap_minus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
654  endcmap_e_minus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
655  }
656  }//iy
657  }//ix
658 
659  } //sign
660 
661 
662 
663  barreletamap.Write();
664  barrelmap_divided.Write();
665  barrelmap.Write();
666  barrelmap_e_divided.Write();
667  barrelmap_e.Write();
668  endcmap_plus_corr.Write();
669  endcmap_minus_corr.Write();
670  endcmap_plus_uncorr.Write();
671  endcmap_minus_uncorr.Write();
672  endcmap_e_plus.Write();
673  endcmap_e_minus.Write();
674 
675 
676  vector<TH1F*> etavsphi_endc(kEndcEtaRings);
677  vector<TH1F*> areavsphi_endc(kEndcEtaRings);
678  vector<TH1F*> etsumvsphi_endcp_corr(kEndcEtaRings);
679  vector<TH1F*> etsumvsphi_endcm_corr(kEndcEtaRings);
680  vector<TH1F*> etsumvsphi_endcp_uncorr(kEndcEtaRings);
681  vector<TH1F*> etsumvsphi_endcm_uncorr(kEndcEtaRings);
682  vector<TH1F*> esumvsphi_endcp(kEndcEtaRings);
683  vector<TH1F*> esumvsphi_endcm(kEndcEtaRings);
684 
685  std::vector<TH1F*> deltaeta_histos(kEndcEtaRings);
686  std::vector<TH1F*> deltaphi_histos(kEndcEtaRings);
687 
688  for(int ring =0; ring<kEndcEtaRings;++ring){
689 
690  ostringstream t;
691  t<< "etavsphi_endc_"<<ring;
692  etavsphi_endc[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
693  t.str("");
694 
695  t<< "areavsphi_endc_"<<ring;
696  areavsphi_endc[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
697  t.str("");
698 
699  t<< "etsumvsphi_endcp_corr_"<<ring;
700  etsumvsphi_endcp_corr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
701  t.str("");
702 
703  t << "etsumvsphi_endcm_corr_"<<ring;
704  etsumvsphi_endcm_corr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
705  t.str("");
706 
707  t << "etsumvsphi_endcp_uncorr_"<<ring;
708  etsumvsphi_endcp_uncorr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
709  t.str("");
710 
711  t << "etsumvsphi_endcm_uncorr_"<<ring;
712  etsumvsphi_endcm_uncorr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
713  t.str("");
714 
715  t << "esumvsphi_endcp_"<<ring;
716  esumvsphi_endcp[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
717  t.str("");
718 
719  t << "esumvsphi_endcm_"<<ring;
720  esumvsphi_endcm[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
721  t.str("");
722 
723  t << "deltaeta_" << ring;
724  deltaeta_histos[ring]= new TH1F(t.str().c_str(),"",50,-.1,.1);
725  t.str("");
726  t << "deltaphi_" << ring;
727  deltaphi_histos[ring]= new TH1F(t.str().c_str(),"",50,-.1,.1);
728  t.str("");
729  }
730 
731  for (int ix=0; ix<kEndcWedgesX; ix++) {
732  for (int iy=0; iy<kEndcWedgesY; iy++) {
733 
734  int ring = e_.endcapRing_[ix][iy];
735  if (ring!=-1) {
736  int iphi_endc=-1;
737  for (int ip=0; ip<e_.nRing_[ring]; ip++) {
738  if (e_.cellPhi_[ix][iy]==e_.phi_endc_[ip][ring]) iphi_endc=ip;
739  }
740 
741  if(iphi_endc!=-1){
742  for (int sign=0; sign<kSides; sign++) {
743  if(e_.goodCell_endc[ix][iy][sign]){
744  if (sign==1){
745  etsumvsphi_endcp_corr[ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
746  etsumvsphi_endcp_uncorr[ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
747  esumvsphi_endcp[ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
748  } else {
749  etsumvsphi_endcm_corr[ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
750  etsumvsphi_endcm_uncorr[ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
751  esumvsphi_endcm[ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
752  }
753  }//if
754  }//sign
755  etavsphi_endc[ring]->Fill(iphi_endc,e_.cellPos_[ix][iy].eta());
756  areavsphi_endc[ring]->Fill(iphi_endc,e_.cellArea_[ix][iy]);
757  } //if iphi_endc
758 
759  }//if ring
760  }//iy
761  } //ix
762 
763 
764 
765  for(int ring =0; ring<kEndcEtaRings;++ring){
766 
767  etavsphi_endc[ring]->Write();
768  areavsphi_endc[ring]->Write();
769  etsumvsphi_endcp_corr[ring]->Write();
770  etsumvsphi_endcm_corr[ring]->Write();
771  etsumvsphi_endcp_uncorr[ring]->Write();
772  etsumvsphi_endcm_uncorr[ring]->Write();
773  esumvsphi_endcp[ring]->Write();
774  esumvsphi_endcm[ring]->Write();
775  deltaeta_histos[ring]->Write();
776  deltaphi_histos[ring]->Write();
777 
778 
779  delete etsumvsphi_endcp_corr[ring];
780  delete etsumvsphi_endcm_corr[ring];
781  delete etsumvsphi_endcp_uncorr[ring];
782  delete etsumvsphi_endcm_uncorr[ring];
783  delete etavsphi_endc[ring];
784  delete areavsphi_endc[ring];
785  delete esumvsphi_endcp[ring];
786  delete esumvsphi_endcm[ring];
787  delete deltaeta_histos[ring];
788  delete deltaphi_histos[ring];
789  }
790 
791 
792  f.Close();
793 }
tuple t
Definition: tree.py:139
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
int nRing_[kEndcEtaRings]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
int nBads_endc[kEndcEtaRings]
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
double sign(double x)
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
static const int kSides
double phi_endc_[kMaxEndciPhi][kEndcEtaRings]
static const int kBarlWedges
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcWedgesX
double etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const int kEndcEtaRings
double f[11][100]
double esum_barl_[kBarlRings][kBarlWedges][kSides]
double cellPhi_[kEndcWedgesX][kEndcWedgesY]
T eta() const
Definition: PV3DBase.h:76
double cellArea_[kEndcWedgesX][kEndcWedgesY]
int nBads_barl[kBarlRings]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
double esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2::outResidHistos ( )

Definition at line 867 of file PhiSymmetryCalibration_step2.cc.

References f, and relativeConstraints::ring.

867  {
868 
869  // output histograms of residual miscalibrations
870  TFile f("PhiSymmetryCalibration_miscal_resid.root","recreate");
871  for (int ieta=0; ieta<85; ieta++) {
872  miscal_resid_barl_histos[ieta]->Write();
873  correl_barl_histos[ieta]->Write();
874 
875  delete miscal_resid_barl_histos[ieta];
876  delete correl_barl_histos[ieta];
877  }
878 
879  for (int ring=0; ring<39; ring++) {
880  miscal_resid_endc_histos[ring]->Write();
881  correl_endc_histos[ring]->Write();
882 
884  delete correl_endc_histos[ring];
885 
886  }
887  f.Close();
888 }
double f[11][100]
std::vector< TH1F * > miscal_resid_endc_histos
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
void PhiSymmetryCalibration_step2::readEtSums ( )

Definition at line 796 of file PhiSymmetryCalibration_step2.cc.

References recoMuon::in, kBarlRings, kEndcEtaRings, nhits, relativeConstraints::ring, and jetcorrextractor::sign().

796  {
797 
798 
799  //read in ET sums
800 
801  int ieta,iphi,sign,ix,iy,dummy;
802  double etsum;
803  unsigned int nhits;
804  std::ifstream etsum_barl_in("etsum_barl.dat", ios::in);
805  while ( etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits ) {
806  etsum_barl_[ieta][iphi][sign]+=etsum;
807  nhits_barl_[ieta][iphi][sign]+=nhits;
808 
809  }
810 
811  std::ifstream etsum_endc_in("etsum_endc.dat", ios::in);
812  while ( etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits>>dummy ) {
813  etsum_endc_[ix][iy][sign]+=etsum;
814  nhits_endc_[ix][iy][sign]+=nhits;
815  }
816 
817  std::ifstream k_barl_in("k_barl.dat", ios::in);
818  for (int ieta=0; ieta<kBarlRings; ieta++) {
819  k_barl_in >> dummy >> k_barl_[ieta];
820  }
821 
822  std::ifstream k_endc_in("k_endc.dat", ios::in);
823  for (int ring=0; ring<kEndcEtaRings; ring++) {
824  k_endc_in >> dummy >> k_endc_[ring];
825  }
826 
827 
828 }
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
double sign(double x)
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcEtaRings
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
void PhiSymmetryCalibration_step2::setUp ( const edm::EventSetup setup)

if a miscalibration was applied, load it, if not put it to 1

Definition at line 51 of file PhiSymmetryCalibration_step2.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), h, AlCaHLTBitMon_ParallelJobs::p, cmsHarvester::path, EcalFloatCondObjectContainerXMLTranslator::readXML(), and run_regression::ret.

51  {
52 
54  se.get<EcalChannelStatusRcd>().get(chStatus);
55 
57  se.get<CaloGeometryRecord>().get(geoHandle);
58 
59  barrelCells = geoHandle->getValidDetIds(DetId::Ecal, EcalBarrel);
60  endcapCells = geoHandle->getValidDetIds(DetId::Ecal, EcalEndcap);
61 
62  e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_);
63 
66 
68  namespace fs = boost::filesystem;
70  if (!fs::exists(p)) edm::LogError("PhiSym") << "File not found: "
71  << initialmiscalibfile_ <<endl;
72 
73  int ret=
75  if (ret) edm::LogError("PhiSym")<<"Error reading XML files"<<endl;;
76  } else {
77 
78  for (vector<DetId>::iterator it=barrelCells.begin(); it!=barrelCells.end(); ++it){
79  miscalib_[*it]=1;
80  }
81 
82  for (vector<DetId>::iterator it=endcapCells.begin(); it!=endcapCells.end(); ++it){
83  miscalib_[*it]=1;
84 
85  }
86  }
87 
88  // if we are reiterating, read constants from previous iter
89  // if not put them to one
90  if (reiteration_){
91 
92 
94  namespace fs = boost::filesystem;
95  fs::path p(oldcalibfile_.c_str());
96  if (!fs::exists(p)) edm::LogError("PhiSym") << "File not found: "
97  << oldcalibfile_ <<endl;
98 
99  int ret=
101  oldCalibs_);
102 
103  if (ret) edm::LogError("PhiSym")<<"Error reading XML files"<<endl;;
104 
105  } else {
106 
107  for (vector<DetId>::iterator it=barrelCells.begin();
108  it!=barrelCells.end(); ++it)
109  oldCalibs_[*it]=1;
110 
111 
112  for (vector<DetId>::iterator it=endcapCells.begin();
113  it!=endcapCells.end(); ++it)
114  oldCalibs_[*it]=1;
115 
116 
117  } // else
118 
119 }
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
tuple path
else: Piece not in the list, fine.
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
void PhiSymmetryCalibration_step2::setupResidHistos ( )

Definition at line 832 of file PhiSymmetryCalibration_step2.cc.

References kBarlRings, kEndcEtaRings, and relativeConstraints::ring.

832  {
833 
836 
837 
838  for (int ieta=0; ieta<kBarlRings; ieta++) {
839  ostringstream t1;
840  t1<<"mr_barl_"<<ieta+1;
841  miscal_resid_barl_histos[ieta] = new TH1F(t1.str().c_str(),"",100,0.,2.);
842  ostringstream t2;
843  t2<<"co_barl_"<<ieta+1;
844  correl_barl_histos[ieta] = new TH2F(t2.str().c_str(),"",50,.5,1.5,50,.5,1.5);
845  }
846 
849 
850 
851  for (int ring=0; ring<kEndcEtaRings; ring++) {
852  ostringstream t1;
853  t1<<"mr_endc_"<< ring+1;
854  miscal_resid_endc_histos[ring] = new TH1F(t1.str().c_str(),"",100,0.,2.);
855  ostringstream t2;
856  t2<<"co_endc_"<<ring+1;
857  correl_endc_histos[ring] = new TH2F(t2.str().c_str(),"",50,.5,1.5,50,.5,1.5);
858  }
859 
860 
861 
862 
863 
864 }
static const int kBarlRings
static const int kEndcEtaRings
std::vector< TH1F * > miscal_resid_endc_histos
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos

Member Data Documentation

std::vector<DetId> PhiSymmetryCalibration_step2::barrelCells
private

Definition at line 70 of file PhiSymmetryCalibration_step2.h.

std::vector<TH2F*> PhiSymmetryCalibration_step2::correl_barl_histos
private

Definition at line 97 of file PhiSymmetryCalibration_step2.h.

std::vector<TH2F*> PhiSymmetryCalibration_step2::correl_endc_histos
private

Definition at line 100 of file PhiSymmetryCalibration_step2.h.

EcalGeomPhiSymHelper PhiSymmetryCalibration_step2::e_
private

Definition at line 68 of file PhiSymmetryCalibration_step2.h.

std::vector<DetId> PhiSymmetryCalibration_step2::endcapCells
private

Definition at line 71 of file PhiSymmetryCalibration_step2.h.

float PhiSymmetryCalibration_step2::epsilon_M_barl[kBarlRings][kBarlWedges][kSides]
private

Definition at line 65 of file PhiSymmetryCalibration_step2.h.

float PhiSymmetryCalibration_step2::epsilon_M_endc[kEndcWedgesX][kEndcWedgesY][kSides]
private

Definition at line 66 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::esum_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 50 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 51 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::esumMean_barl_[kBarlRings]
private

Definition at line 53 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::esumMean_endc_[kEndcEtaRings]
private

Definition at line 54 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::etsum_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 40 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 41 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 42 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::etsumMean_barl_[kBarlRings]
private

Definition at line 43 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::etsumMean_endc_[kEndcEtaRings]
private

Definition at line 44 of file PhiSymmetryCalibration_step2.h.

bool PhiSymmetryCalibration_step2::firstpass_
private

Definition at line 73 of file PhiSymmetryCalibration_step2.h.

bool PhiSymmetryCalibration_step2::have_initial_miscalib_
private

Definition at line 91 of file PhiSymmetryCalibration_step2.h.

std::string PhiSymmetryCalibration_step2::initialmiscalibfile_
private

Definition at line 92 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::k_barl_[kBarlRings]
private

Definition at line 56 of file PhiSymmetryCalibration_step2.h.

double PhiSymmetryCalibration_step2::k_endc_[kEndcEtaRings]
private

Definition at line 57 of file PhiSymmetryCalibration_step2.h.

std::vector<TH1F*> PhiSymmetryCalibration_step2::miscal_resid_barl_histos
private

res miscalib histos

Definition at line 96 of file PhiSymmetryCalibration_step2.h.

std::vector<TH1F*> PhiSymmetryCalibration_step2::miscal_resid_endc_histos
private

Definition at line 99 of file PhiSymmetryCalibration_step2.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2::miscalib_
private

initial miscalibration applied if any)

Definition at line 88 of file PhiSymmetryCalibration_step2.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2::newCalibs_
private

calib constants that we are going to calculate

Definition at line 84 of file PhiSymmetryCalibration_step2.h.

unsigned int PhiSymmetryCalibration_step2::nhits_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 46 of file PhiSymmetryCalibration_step2.h.

unsigned int PhiSymmetryCalibration_step2::nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 47 of file PhiSymmetryCalibration_step2.h.

std::string PhiSymmetryCalibration_step2::oldcalibfile_
private

Definition at line 78 of file PhiSymmetryCalibration_step2.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2::oldCalibs_
private

the old calibration constants (when reiterating, the last ones derived)

Definition at line 81 of file PhiSymmetryCalibration_step2.h.

float PhiSymmetryCalibration_step2::rawconst_barl[kBarlRings][kBarlWedges][kSides]
private

Definition at line 60 of file PhiSymmetryCalibration_step2.h.

float PhiSymmetryCalibration_step2::rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 61 of file PhiSymmetryCalibration_step2.h.

bool PhiSymmetryCalibration_step2::reiteration_
private

Definition at line 77 of file PhiSymmetryCalibration_step2.h.

int PhiSymmetryCalibration_step2::statusThreshold_
private

Definition at line 74 of file PhiSymmetryCalibration_step2.h.