CMS 3D CMS Logo

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

#include <PhiSymmetryCalibration_step2_SM.h>

Inheritance diagram for PhiSymmetryCalibration_step2_SM:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void fillConstantsHistos ()
 
void fillHistos ()
 
void outResidHistos ()
 
 PhiSymmetryCalibration_step2_SM (const edm::ParameterSet &iConfig)
 
void readEtSums ()
 
void setUp (const edm::EventSetup &setup)
 
void setupResidHistos ()
 
 ~PhiSymmetryCalibration_step2_SM () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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< 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]
 
double epsilon_M_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][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_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][kSides]
 
double etsum_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsum_endc_uncorr [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsumMean_barl_ [kBarlRings]
 
double etsumMean_barl_SM_ [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...
 
int nBads_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][kSides]
 
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_
 

Static Private Attributes

static const int nscx = 20
 

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
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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_SM.h.

Constructor & Destructor Documentation

PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM ( const edm::ParameterSet iConfig)

Definition at line 23 of file PhiSymmetryCalibration_step2_SM.cc.

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

23  {
24  statusThreshold_ = iConfig.getUntrackedParameter<int>("statusThreshold", 0);
25  have_initial_miscalib_ = iConfig.getUntrackedParameter<bool>("haveInitialMiscalib", false);
26  initialmiscalibfile_ = iConfig.getUntrackedParameter<std::string>("initialmiscalibfile", "InitialMiscalib.xml");
27  oldcalibfile_ = iConfig.getUntrackedParameter<std::string>("oldcalibfile", "EcalIntercalibConstants.xml");
28  reiteration_ = iConfig.getUntrackedParameter<bool>("reiteration", false);
29  firstpass_ = true;
30 }
T getUntrackedParameter(std::string const &, T const &) const
PhiSymmetryCalibration_step2_SM::~PhiSymmetryCalibration_step2_SM ( )
override

Definition at line 21 of file PhiSymmetryCalibration_step2_SM.cc.

21 {}

Member Function Documentation

void PhiSymmetryCalibration_step2_SM::analyze ( const edm::Event ev,
const edm::EventSetup se 
)
override

Definition at line 32 of file PhiSymmetryCalibration_step2_SM.cc.

32  {
33  if (firstpass_) {
34  setUp(se);
35  firstpass_ = false;
36  }
37 }
void setUp(const edm::EventSetup &setup)
void PhiSymmetryCalibration_step2_SM::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 109 of file PhiSymmetryCalibration_step2_SM.cc.

References LEDCalibrationChannels::ieta, createfilelist::int, LEDCalibrationChannels::iphi, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, and Validation_hcalonly_cfi::sign.

109  {
110  for (int ieta = 0; ieta < kBarlRings; ieta++) {
111  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
112  for (int sign = 0; sign < kSides; sign++) {
113  int iphi_r = int(iphi / nscx);
114 
115  etsum_barl_[ieta][iphi][sign] = 0.;
116  nhits_barl_[ieta][iphi][sign] = 0;
117  esum_barl_[ieta][iphi][sign] = 0.;
118  etsum_barl_SM_[ieta][iphi_r][sign] = 0;
119  nBads_barl_SM_[ieta][iphi_r][sign] = 0;
120  epsilon_M_barl_SM_[ieta][iphi_r][sign] = 0;
121  }
122  }
123  etsumMean_barl_SM_[ieta] = 0.;
124  }
125 
126  for (int ix = 0; ix < kEndcWedgesX; ix++) {
127  for (int iy = 0; iy < kEndcWedgesY; iy++) {
128  for (int sign = 0; sign < kSides; sign++) {
129  etsum_endc_[ix][iy][sign] = 0.;
130  nhits_endc_[ix][iy][sign] = 0;
131  esum_endc_[ix][iy][sign] = 0.;
132  }
133  }
134  }
135 
136  readEtSums();
138 }
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kSides
int nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kBarlWedges
static const int kEndcWedgesX
double esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double epsilon_M_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
double esum_barl_[kBarlRings][kBarlWedges][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::endJob ( void  )
overridevirtual

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 140 of file PhiSymmetryCalibration_step2_SM.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 310 of file PhiSymmetryCalibration_step2_SM.cc.

References f, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, Validation_hcalonly_cfi::sign, and EEDetId::validDetId().

310  {
311  TFile f("CalibHistos.root", "recreate");
312 
313  TH2F barreletamap("barreletamap", "barreletamap", 171, -85, 86, 100, 0., 2.);
314  TH2F barreletamapraw("barreletamapraw", "barreletamapraw", 171, -85, 86, 100, 0., 2.);
315 
316  TH2F barrelmapold("barrelmapold", "barrelmapold", 360, 1., 361., 171, -85., 86.);
317  TH2F barrelmapnew("barrelmapnew", "barrelmapnew", 360, 1., 361., 171, -85., 86.);
318  TH2F barrelmapratio("barrelmapratio", "barrelmapratio", 360, 1., 361., 171, -85., 86.);
319 
320  TH1F rawconst_endc_h("rawconst_endc", "rawconst_endc", 100, 0., 2.);
321  TH1F const_endc_h("const_endc", "const_endc", 100, 0., 2.);
322 
323  TH1F oldconst_endc_h("oldconst_endc", "oldconst_endc;oldCalib;", 200, 0, 2);
324  TH2F newvsraw_endc_h("newvsraw_endc", "newvsraw_endc;rawConst;newCalib", 200, 0, 2, 200, 0, 2);
325 
326  TH2F endcapmapold_plus("endcapmapold_plus", "endcapmapold_plus", 100, 1., 101., 100, 1., 101.);
327  TH2F endcapmapnew_plus("endcapmapnew_plus", "endcapmapnew_plus", 100, 1., 101., 100, 1., 101.);
328  TH2F endcapmapratio_plus("endcapmapratio_plus", "endcapmapratio_plus", 100, 1., 101., 100, 1., 101.);
329 
330  TH2F endcapmapold_minus("endcapmapold_minus", "endcapmapold_minus", 100, 1., 101., 100, 1., 101.);
331  TH2F endcapmapnew_minus("endcapmapnew_minus", "endcapmapnew_minus", 100, 1., 101., 100, 1., 101.);
332  TH2F endcapmapratio_minus("endcapmapratio_minus", "endcapmapratio_minus", 100, 1., 101., 100, 1., 101.);
333 
334  for (int sign = 0; sign < kSides; sign++) {
335  int thesign = sign == 1 ? 1 : -1;
336 
337  for (int ieta = 0; ieta < kBarlRings; ieta++) {
338  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
339  if (e_.goodCell_barl[ieta][iphi][sign]) {
340  EBDetId eb(thesign * (ieta + 1), iphi + 1);
341  //int mod20= (iphi+1)%20;
342  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
343  barreletamap.Fill(ieta * thesign + thesign, newCalibs_[eb]);
344  barreletamapraw.Fill(ieta * thesign + thesign, rawconst_barl[ieta][iphi][sign]);
345 
346  barrelmapold.Fill(iphi + 1, ieta * thesign + thesign, oldCalibs_[eb]);
347  barrelmapnew.Fill(iphi + 1, ieta * thesign + thesign, newCalibs_[eb]);
348  barrelmapratio.Fill(iphi + 1, ieta * thesign + thesign, newCalibs_[eb] / oldCalibs_[eb]);
349  } //if
350  } //iphi
351  } //ieta
352 
353  for (int ix = 0; ix < kEndcWedgesX; ix++) {
354  for (int iy = 0; iy < kEndcWedgesY; iy++) {
355  if (e_.goodCell_endc[ix][iy][sign]) {
356  if (!EEDetId::validDetId(ix + 1, iy + 1, thesign))
357  continue;
358  EEDetId ee(ix + 1, iy + 1, thesign);
359 
360  rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
361  const_endc_h.Fill(newCalibs_[ee]);
362  oldconst_endc_h.Fill(oldCalibs_[ee]);
363  newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign], newCalibs_[ee]);
364 
365  if (sign == 1) {
366  endcapmapold_plus.Fill(ix + 1, iy + 1, oldCalibs_[ee]);
367  endcapmapnew_plus.Fill(ix + 1, iy + 1, newCalibs_[ee]);
368  endcapmapratio_plus.Fill(ix + 1, iy + 1, newCalibs_[ee] / oldCalibs_[ee]);
369  } else {
370  endcapmapold_minus.Fill(ix + 1, iy + 1, oldCalibs_[ee]);
371  endcapmapnew_minus.Fill(ix + 1, iy + 1, newCalibs_[ee]);
372  endcapmapratio_minus.Fill(ix + 1, iy + 1, newCalibs_[ee] / oldCalibs_[ee]);
373  }
374 
375  } //if
376  } //iy
377  } //ix
378 
379  } // sides
380 
381  barreletamap.Write();
382  barreletamapraw.Write();
383  rawconst_endc_h.Write();
384  const_endc_h.Write();
385  oldconst_endc_h.Write();
386  newvsraw_endc_h.Write();
387  barrelmapold.Write();
388  barrelmapnew.Write();
389  barrelmapratio.Write();
390  endcapmapold_plus.Write();
391  endcapmapnew_plus.Write();
392  endcapmapratio_plus.Write();
393  endcapmapold_minus.Write();
394  endcapmapnew_minus.Write();
395  endcapmapratio_minus.Write();
396 
397  f.Close();
398 }
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
static const int kSides
static const int kBarlWedges
static const int kEndcWedgesX
double f[11][100]
float rawconst_barl[kBarlRings][kBarlWedges][kSides]
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
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::fillHistos ( )

Definition at line 402 of file PhiSymmetryCalibration_step2_SM.cc.

References custom_jme_cff::area, f, dqmMemoryStats::float, LaserClient_cfi::high, LEDCalibrationChannels::ieta, createfilelist::int, LEDCalibrationChannels::iphi, kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, LaserClient_cfi::low, relativeConstraints::ring, Validation_hcalonly_cfi::sign, and OrderedSet::t.

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

Definition at line 848 of file PhiSymmetryCalibration_step2_SM.cc.

References f, LEDCalibrationChannels::ieta, and relativeConstraints::ring.

848  {
849  // output histograms of residual miscalibrations
850  TFile f("PhiSymmetryCalibration_miscal_resid.root", "recreate");
851  for (int ieta = 0; ieta < 85; ieta++) {
852  miscal_resid_barl_histos[ieta]->Write();
853  correl_barl_histos[ieta]->Write();
854 
856  delete correl_barl_histos[ieta];
857  }
858 
859  for (int ring = 0; ring < 39; ring++) {
860  miscal_resid_endc_histos[ring]->Write();
861  correl_endc_histos[ring]->Write();
862 
864  delete correl_endc_histos[ring];
865  }
866  f.Close();
867 }
double f[11][100]
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
void PhiSymmetryCalibration_step2_SM::readEtSums ( )

Definition at line 785 of file PhiSymmetryCalibration_step2_SM.cc.

References LEDCalibrationChannels::ieta, recoMuon::in, createfilelist::int, LEDCalibrationChannels::iphi, kBarlRings, kEndcEtaRings, nhits, relativeConstraints::ring, and Validation_hcalonly_cfi::sign.

785  {
786  //read in ET sums
787 
788  int ieta, iphi, sign, ix, iy, dummy;
789  double etsum;
790  unsigned int nhits;
791  std::ifstream etsum_barl_in("etsum_barl.dat", ios::in);
792  while (etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits) {
793  etsum_barl_[ieta][iphi][sign] += etsum;
795 
796  // fill etsums for the SM calibration
797  int iphi_r = int(iphi / nscx);
798  etsum_barl_SM_[ieta][iphi_r][sign] += etsum;
799  // etsum*nscx/(nscx- nBads_barl_SM_[ieta][iphi_r][sign]);
800  // if(nBads_barl_SM_[ieta][iphi_r][sign]>0){
801  // std::cout << "ETSUM" << etsum_barl_SM_[ieta][iphi_r][sign] << " " << nscx << " " << nBads_barl_SM_[ieta][iphi_r][sign]<< endl;
802  // }
803  }
804 
805  std::ifstream etsum_endc_in("etsum_endc.dat", ios::in);
806  while (etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits >> dummy) {
807  etsum_endc_[ix][iy][sign] += etsum;
808  nhits_endc_[ix][iy][sign] += nhits;
809  }
810 
811  std::ifstream k_barl_in("k_barl.dat", ios::in);
812  for (int ieta = 0; ieta < kBarlRings; ieta++) {
813  k_barl_in >> dummy >> k_barl_[ieta];
814  }
815 
816  std::ifstream k_endc_in("k_endc.dat", ios::in);
817  for (int ring = 0; ring < kEndcEtaRings; ring++) {
818  k_endc_in >> dummy >> k_endc_[ring];
819  }
820 }
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kEndcEtaRings
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
void PhiSymmetryCalibration_step2_SM::setUp ( const edm::EventSetup setup)

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

Definition at line 39 of file PhiSymmetryCalibration_step2_SM.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), CaloGeometry::getValidDetIds(), h, LEDCalibrationChannels::ieta, createfilelist::int, LEDCalibrationChannels::iphi, kBarlRings, kBarlWedges, kSides, AlCaHLTBitMon_ParallelJobs::p, castor_dqm_sourceclient_file_cfg::path, EcalFloatCondObjectContainerXMLTranslator::readXML(), runTheMatrix::ret, and Validation_hcalonly_cfi::sign.

39  {
41  se.get<EcalChannelStatusRcd>().get(chStatus);
42 
44  se.get<CaloGeometryRecord>().get(geoHandle);
45 
48 
49  e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_);
50 
51  for (int sign = 0; sign < kSides; sign++) {
52  for (int ieta = 0; ieta < kBarlRings; ieta++) {
53  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
54  int iphi_r = int(iphi / nscx);
55  if (!e_.goodCell_barl[ieta][iphi][sign]) {
56  nBads_barl_SM_[ieta][iphi_r][sign]++;
57  // std::cout << "N BAD CELL " << nBads_barl_SM_[ieta][iphi_r][sign] << endl;
58  }
59  }
60  }
61  }
62 
66  namespace fs = boost::filesystem;
68  if (!fs::exists(p))
69  edm::LogError("PhiSym") << "File not found: " << initialmiscalibfile_ << endl;
70 
72  if (ret)
73  edm::LogError("PhiSym") << "Error reading XML files" << endl;
74  } else {
75  for (vector<DetId>::iterator it = barrelCells.begin(); it != barrelCells.end(); ++it) {
76  miscalib_[*it] = 1;
77  }
78 
79  for (vector<DetId>::iterator it = endcapCells.begin(); it != endcapCells.end(); ++it) {
80  miscalib_[*it] = 1;
81  }
82  }
83 
84  // if we are reiterating, read constants from previous iter
85  // if not put them to one
86  if (reiteration_) {
88  namespace fs = boost::filesystem;
89  fs::path p(oldcalibfile_.c_str());
90  if (!fs::exists(p))
91  edm::LogError("PhiSym") << "File not found: " << oldcalibfile_ << endl;
92 
94 
95  if (ret)
96  edm::LogError("PhiSym") << "Error reading XML files" << endl;
97  ;
98 
99  } else {
100  for (vector<DetId>::iterator it = barrelCells.begin(); it != barrelCells.end(); ++it)
101  oldCalibs_[*it] = 1;
102 
103  for (vector<DetId>::iterator it = endcapCells.begin(); it != endcapCells.end(); ++it)
104  oldCalibs_[*it] = 1;
105 
106  } // else
107 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
ret
prodAgent to be discontinued
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
static const int kSides
int nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
static const int kBarlWedges
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
void PhiSymmetryCalibration_step2_SM::setupResidHistos ( )

Definition at line 822 of file PhiSymmetryCalibration_step2_SM.cc.

References LEDCalibrationChannels::ieta, kBarlRings, kEndcEtaRings, relativeConstraints::ring, RandomServiceHelper::t1, and RandomServiceHelper::t2.

822  {
825 
826  for (int ieta = 0; ieta < kBarlRings; ieta++) {
827  ostringstream t1;
828  t1 << "mr_barl_" << ieta + 1;
829  miscal_resid_barl_histos[ieta] = new TH1F(t1.str().c_str(), "", 100, 0., 2.);
830  ostringstream t2;
831  t2 << "co_barl_" << ieta + 1;
832  correl_barl_histos[ieta] = new TH2F(t2.str().c_str(), "", 50, .5, 1.5, 50, .5, 1.5);
833  }
834 
837 
838  for (int ring = 0; ring < kEndcEtaRings; ring++) {
839  ostringstream t1;
840  t1 << "mr_endc_" << ring + 1;
841  miscal_resid_endc_histos[ring] = new TH1F(t1.str().c_str(), "", 100, 0., 2.);
842  ostringstream t2;
843  t2 << "co_endc_" << ring + 1;
844  correl_endc_histos[ring] = new TH2F(t2.str().c_str(), "", 50, .5, 1.5, 50, .5, 1.5);
845  }
846 }
static const int kBarlRings
static const int kEndcEtaRings
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos

Member Data Documentation

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

Definition at line 70 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 94 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 97 of file PhiSymmetryCalibration_step2_SM.h.

EcalGeomPhiSymHelper PhiSymmetryCalibration_step2_SM::e_
private

Definition at line 68 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 71 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 65 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::epsilon_M_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 41 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 66 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 51 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 52 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esumMean_barl_[kBarlRings]
private

Definition at line 54 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esumMean_endc_[kEndcEtaRings]
private

Definition at line 55 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 33 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 38 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 43 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 44 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_barl_[kBarlRings]
private

Definition at line 45 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_barl_SM_[kBarlRings]
private

Definition at line 40 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_endc_[kEndcEtaRings]
private

Definition at line 46 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::firstpass_
private

Definition at line 73 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::have_initial_miscalib_
private

Definition at line 89 of file PhiSymmetryCalibration_step2_SM.h.

std::string PhiSymmetryCalibration_step2_SM::initialmiscalibfile_
private

Definition at line 90 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::k_barl_[kBarlRings]
private

Definition at line 57 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::k_endc_[kEndcEtaRings]
private

Definition at line 58 of file PhiSymmetryCalibration_step2_SM.h.

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

res miscalib histos

Definition at line 93 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 96 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::miscalib_
private

initial miscalibration applied if any)

Definition at line 86 of file PhiSymmetryCalibration_step2_SM.h.

int PhiSymmetryCalibration_step2_SM::nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 39 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::newCalibs_
private

calib constants that we are going to calculate

Definition at line 83 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 48 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 49 of file PhiSymmetryCalibration_step2_SM.h.

const int PhiSymmetryCalibration_step2_SM::nscx = 20
staticprivate

Definition at line 37 of file PhiSymmetryCalibration_step2_SM.h.

std::string PhiSymmetryCalibration_step2_SM::oldcalibfile_
private

Definition at line 77 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::oldCalibs_
private

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

Definition at line 80 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 61 of file PhiSymmetryCalibration_step2_SM.h.

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

Definition at line 62 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::reiteration_
private

Definition at line 76 of file PhiSymmetryCalibration_step2_SM.h.

int PhiSymmetryCalibration_step2_SM::statusThreshold_
private

Definition at line 74 of file PhiSymmetryCalibration_step2_SM.h.