CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PhiSymmetryCalibration_step2 Class Reference

#include <PhiSymmetryCalibration_step2.h>

Inheritance diagram for PhiSymmetryCalibration_step2:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase 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 (const edm::ParameterSet &iConfig)
 
void readEtSums ()
 
void setUp (const edm::EventSetup &setup)
 
void setupResidHistos ()
 
 ~PhiSymmetryCalibration_step2 () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
 
const edm::ESGetToken
< EcalChannelStatus,
EcalChannelStatusRcd
channelStatusToken_
 
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_
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
geometryToken_
 
const bool have_initial_miscalib_
 
const 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]
 
const 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]
 
const bool reiteration_
 
const int statusThreshold_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 17 of file PhiSymmetryCalibration_step2.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file PhiSymmetryCalibration_step2.cc.

23  firstpass_(true),
24  statusThreshold_(iConfig.getUntrackedParameter<int>("statusThreshold", 0)),
25  reiteration_(iConfig.getUntrackedParameter<bool>("reiteration", false)),
26  oldcalibfile_(iConfig.getUntrackedParameter<std::string>("oldcalibfile", "EcalIntercalibConstants.xml")),
27  have_initial_miscalib_(iConfig.getUntrackedParameter<bool>("haveInitialMiscalib", false)),
28  initialmiscalibfile_(iConfig.getUntrackedParameter<std::string>("initialmiscalibfile", "InitialMiscalib.xml")) {}
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelStatusToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
PhiSymmetryCalibration_step2::~PhiSymmetryCalibration_step2 ( )
override

Definition at line 18 of file PhiSymmetryCalibration_step2.cc.

18 {}

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 30 of file PhiSymmetryCalibration_step2.cc.

References firstpass_, and setUp().

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 94 of file PhiSymmetryCalibration_step2.cc.

References esum_barl_, esum_endc_, etsum_barl_, etsum_endc_, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, nhits_barl_, nhits_endc_, readEtSums(), setupResidHistos(), and jetcorrextractor::sign().

94  {
95  for (int ieta = 0; ieta < kBarlRings; ieta++) {
96  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
97  for (int sign = 0; sign < kSides; sign++) {
98  etsum_barl_[ieta][iphi][sign] = 0.;
99  nhits_barl_[ieta][iphi][sign] = 0;
100  esum_barl_[ieta][iphi][sign] = 0.;
101  }
102  }
103  }
104 
105  for (int ix = 0; ix < kEndcWedgesX; ix++) {
106  for (int iy = 0; iy < kEndcWedgesY; iy++) {
107  for (int sign = 0; sign < kSides; sign++) {
108  etsum_endc_[ix][iy][sign] = 0.;
109  nhits_endc_[ix][iy][sign] = 0;
110  esum_endc_[ix][iy][sign] = 0.;
111  }
112  }
113  }
114 
115  readEtSums();
117 }
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  )
overridevirtual

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

residual miscalibraition / expected precision

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 119 of file PhiSymmetryCalibration_step2.cc.

References funct::abs(), barrelCells, EcalGeomPhiSymHelper::cellArea_, EcalGeomPhiSymHelper::cellPos_, correl_barl_histos, correl_endc_histos, EcalCondHeader::datasource_, EcalCondHeader::date_, e_, endcapCells, EcalGeomPhiSymHelper::endcapRing_, epsilon_M_barl, epsilon_M_endc, PV3DBase< T, PVType, FrameType >::eta(), etsum_barl_, etsum_endc_, etsum_endc_uncorr, etsumMean_barl_, etsumMean_endc_, fillConstantsHistos(), fillHistos(), firstpass_, EcalGeomPhiSymHelper::goodCell_barl, EcalGeomPhiSymHelper::goodCell_endc, EBDetId::ieta(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), k_barl_, k_endc_, kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, EcalGeomPhiSymHelper::meanCellArea_, EcalCondHeader::method_, miscal_resid_barl_histos, miscal_resid_endc_histos, miscalib_, newCalibs_, oldCalibs_, submitPVResolutionJobs::out, outResidHistos(), rawconst_barl, rawconst_endc, relativeConstraints::ring, jetcorrextractor::sign(), EcalCondHeader::since_, AlCaHLTBitMon_QueryRunRegistry::string, EcalCondHeader::tag_, EcalCondHeader::version_, EcalFloatCondObjectContainerXMLTranslator::writeXML(), EBDetId::zside(), and EEDetId::zside().

Referenced by o2olib.O2ORunMgr::executeJob().

119  {
120  if (firstpass_) {
121  edm::LogError("PhiSym") << "Must process at least one event-Exiting" << endl;
122  return;
123  }
124 
125  // Here the real calculation of constants happens
126 
127  // perform the area correction for endcap etsum
128  // NOT USED ANYMORE
129 
130  for (int ix = 0; ix < kEndcWedgesX; ix++) {
131  for (int iy = 0; iy < kEndcWedgesY; iy++) {
132  int ring = e_.endcapRing_[ix][iy];
133 
134  if (ring != -1) {
135  for (int sign = 0; sign < kSides; sign++) {
136  etsum_endc_uncorr[ix][iy][sign] = etsum_endc_[ix][iy][sign];
137  etsum_endc_[ix][iy][sign] *= e_.meanCellArea_[ring] / e_.cellArea_[ix][iy];
138  }
139  }
140  }
141  }
142 
143  // ETsum histos, maps and other usefull histos (area,...)
144  // are filled and saved here
145  fillHistos();
146 
147  // write ETsum mean for all rings
148  std::ofstream etsumMean_barl_out("etsumMean_barl.dat", ios::out);
149  for (int ieta = 0; ieta < kBarlRings; ieta++) {
150  etsumMean_barl_out << ieta << " " << etsumMean_barl_[ieta] << endl;
151  }
152  etsumMean_barl_out.close();
153 
154  std::ofstream etsumMean_endc_out("etsumMean_endc.dat", ios::out);
155  for (int ring = 0; ring < kEndcEtaRings; ring++) {
156  etsumMean_endc_out << e_.cellPos_[ring][50].eta() << " " << etsumMean_endc_[ring] << endl;
157  }
158  etsumMean_endc_out.close();
159 
160  // determine barrel calibration constants
161  for (int ieta = 0; ieta < kBarlRings; ieta++) {
162  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
163  for (int sign = 0; sign < kSides; sign++) {
164  if (e_.goodCell_barl[ieta][iphi][sign]) {
165  float etsum = etsum_barl_[ieta][iphi][sign];
166  float epsilon_T = (etsum / etsumMean_barl_[ieta]) - 1.;
167  rawconst_barl[ieta][iphi][sign] = epsilon_T + 1.;
168  epsilon_M_barl[ieta][iphi][sign] = epsilon_T / k_barl_[ieta];
169  } else {
170  rawconst_barl[ieta][iphi][sign] = 1.;
171  epsilon_M_barl[ieta][iphi][sign] = 0.;
172  } //if
173  } //sign
174  } //iphi
175  } //ieta
176 
177  // determine endcap calibration constants
178  for (int ix = 0; ix < kEndcWedgesX; ix++) {
179  for (int iy = 0; iy < kEndcWedgesY; iy++) {
180  for (int sign = 0; sign < kSides; sign++) {
181  int ring = e_.endcapRing_[ix][iy];
182  if (ring != -1 && e_.goodCell_endc[ix][iy][sign]) {
183  float etsum = etsum_endc_[ix][iy][sign];
184  float epsilon_T = (etsum / etsumMean_endc_[ring]) - 1.;
185  rawconst_endc[ix][iy][sign] = epsilon_T + 1.;
186  epsilon_M_endc[ix][iy][sign] = epsilon_T / k_endc_[ring];
187  } else {
188  epsilon_M_endc[ix][iy][0] = 0.;
189  epsilon_M_endc[ix][iy][1] = 0.;
190  rawconst_endc[ix][iy][0] = 1.;
191  rawconst_endc[ix][iy][1] = 1.;
192  } //if
193  } //sign
194  } //iy
195  } //ix
196 
197  std::string newcalibfile("EcalIntercalibConstants_new.xml");
198 
199  TFile ehistof("ehistos.root", "recreate");
200 
201  TH1D ebhisto("eb", "eb", 100, 0., 2.);
202 
203  std::vector<DetId>::const_iterator barrelIt = barrelCells.begin();
204  for (; barrelIt != barrelCells.end(); barrelIt++) {
205  EBDetId eb(*barrelIt);
206  int ieta = abs(eb.ieta()) - 1;
207  int iphi = eb.iphi() - 1;
208  int sign = eb.zside() > 0 ? 1 : 0;
209 
212  newCalibs_[eb] = oldCalibs_[eb] / (1 + epsilon_M_barl[ieta][iphi][sign]);
213 
214  if (e_.goodCell_barl[ieta][iphi][sign]) {
215  ebhisto.Fill(newCalibs_[eb]);
216 
218  miscal_resid_barl_histos[ieta]->Fill(miscalib_[eb] * newCalibs_[eb]);
219  correl_barl_histos[ieta]->Fill(miscalib_[eb], newCalibs_[eb]);
220  }
221 
222  } // barrelit
223 
224  TH1D eehisto("ee", "ee", 100, 0., 2.);
225  std::vector<DetId>::const_iterator endcapIt = endcapCells.begin();
226 
227  for (; endcapIt != endcapCells.end(); endcapIt++) {
228  EEDetId ee(*endcapIt);
229  int ix = ee.ix() - 1;
230  int iy = ee.iy() - 1;
231  int sign = ee.zside() > 0 ? 1 : 0;
232 
233  newCalibs_[ee] = oldCalibs_[ee] / (1 + epsilon_M_endc[ix][iy][sign]);
234 
235  if (e_.goodCell_endc[ix][iy][sign]) {
236  eehisto.Fill(newCalibs_[ee]);
237  miscal_resid_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee] * newCalibs_[ee]);
238  ;
239 
240  correl_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee], newCalibs_[ee]);
241  }
242  } //endcapit
243  // Write xml file
244  EcalCondHeader header;
245  header.method_ = "phi symmetry";
246  header.version_ = "0";
247  header.datasource_ = "testdata";
248  header.since_ = 1;
249  header.tag_ = "unknown";
250  header.date_ = "Mar 24 1973";
251 
253 
254  eehisto.Write();
255  ebhisto.Write();
256  ehistof.Close();
257 
259 
260  outResidHistos();
261 
262  // finally output global etsums
263  std::fstream ebf("etsummary_barl.dat", ios::out);
264  std::fstream eef("etsummary_endc.dat", ios::out);
265 
266  for (int ieta = 0; ieta < kBarlRings; ieta++) {
267  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
268  for (int sign = 0; sign < kSides; sign++) {
269  ebf << ieta << " " << iphi << " " << sign << " " << etsum_barl_[ieta][iphi][sign] << endl;
270  }
271  }
272  }
273 
274  for (int ix = 0; ix < kEndcWedgesX; ix++) {
275  for (int iy = 0; iy < kEndcWedgesY; iy++) {
276  for (int sign = 0; sign < kSides; sign++) {
277  eef << ix << " " << iy << " " << sign << " " << etsum_endc_[ix][iy][sign] << endl;
278  }
279  }
280  }
281 }
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
Log< level::Error, false > LogError
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_
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:73
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 283 of file PhiSymmetryCalibration_step2.cc.

References e_, validate-o2o-wbm::f, EcalGeomPhiSymHelper::goodCell_barl, EcalGeomPhiSymHelper::goodCell_endc, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, newCalibs_, oldCalibs_, rawconst_barl, rawconst_endc, jetcorrextractor::sign(), and EEDetId::validDetId().

Referenced by endJob().

283  {
284  TFile f("CalibHistos.root", "recreate");
285 
286  TH2F barreletamap("barreletamap", "barreletamap", 171, -85, 86, 100, 0., 2.);
287  TH2F barreletamapraw("barreletamapraw", "barreletamapraw", 171, -85, 86, 100, 0., 2.);
288 
289  TH2F barrelmapold("barrelmapold", "barrelmapold", 360, 1., 361., 171, -85., 86.);
290  TH2F barrelmapnew("barrelmapnew", "barrelmapnew", 360, 1., 361., 171, -85., 86.);
291  TH2F barrelmapratio("barrelmapratio", "barrelmapratio", 360, 1., 361., 171, -85., 86.);
292 
293  TH1F rawconst_endc_h("rawconst_endc", "rawconst_endc", 100, 0., 2.);
294  TH1F const_endc_h("const_endc", "const_endc", 100, 0., 2.);
295 
296  TH1F oldconst_endc_h("oldconst_endc", "oldconst_endc;oldCalib;", 200, 0, 2);
297  TH2F newvsraw_endc_h("newvsraw_endc", "newvsraw_endc;rawConst;newCalib", 200, 0, 2, 200, 0, 2);
298 
299  TH2F endcapmapold_plus("endcapmapold_plus", "endcapmapold_plus", 100, 1., 101., 100, 1., 101.);
300  TH2F endcapmapnew_plus("endcapmapnew_plus", "endcapmapnew_plus", 100, 1., 101., 100, 1., 101.);
301  TH2F endcapmapratio_plus("endcapmapratio_plus", "endcapmapratio_plus", 100, 1., 101., 100, 1., 101.);
302 
303  TH2F endcapmapold_minus("endcapmapold_minus", "endcapmapold_minus", 100, 1., 101., 100, 1., 101.);
304  TH2F endcapmapnew_minus("endcapmapnew_minus", "endcapmapnew_minus", 100, 1., 101., 100, 1., 101.);
305  TH2F endcapmapratio_minus("endcapmapratio_minus", "endcapmapratio_minus", 100, 1., 101., 100, 1., 101.);
306 
307  for (int sign = 0; sign < kSides; sign++) {
308  int thesign = sign == 1 ? 1 : -1;
309 
310  for (int ieta = 0; ieta < kBarlRings; ieta++) {
311  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
312  if (e_.goodCell_barl[ieta][iphi][sign]) {
313  EBDetId eb(thesign * (ieta + 1), iphi + 1);
314  //int mod20= (iphi+1)%20;
315  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
316  barreletamap.Fill(ieta * thesign + thesign, newCalibs_[eb]);
317  barreletamapraw.Fill(ieta * thesign + thesign, rawconst_barl[ieta][iphi][sign]);
318 
319  barrelmapold.Fill(iphi + 1, ieta * thesign + thesign, oldCalibs_[eb]);
320  barrelmapnew.Fill(iphi + 1, ieta * thesign + thesign, newCalibs_[eb]);
321  barrelmapratio.Fill(iphi + 1, ieta * thesign + thesign, newCalibs_[eb] / oldCalibs_[eb]);
322  } //if
323  } //iphi
324  } //ieta
325 
326  for (int ix = 0; ix < kEndcWedgesX; ix++) {
327  for (int iy = 0; iy < kEndcWedgesY; iy++) {
328  if (e_.goodCell_endc[ix][iy][sign]) {
329  if (!EEDetId::validDetId(ix + 1, iy + 1, thesign))
330  continue;
331  EEDetId ee(ix + 1, iy + 1, thesign);
332 
333  rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
334  const_endc_h.Fill(newCalibs_[ee]);
335  oldconst_endc_h.Fill(oldCalibs_[ee]);
336  newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign], newCalibs_[ee]);
337 
338  if (sign == 1) {
339  endcapmapold_plus.Fill(ix + 1, iy + 1, oldCalibs_[ee]);
340  endcapmapnew_plus.Fill(ix + 1, iy + 1, newCalibs_[ee]);
341  endcapmapratio_plus.Fill(ix + 1, iy + 1, newCalibs_[ee] / oldCalibs_[ee]);
342  } else {
343  endcapmapold_minus.Fill(ix + 1, iy + 1, oldCalibs_[ee]);
344  endcapmapnew_minus.Fill(ix + 1, iy + 1, newCalibs_[ee]);
345  endcapmapratio_minus.Fill(ix + 1, iy + 1, newCalibs_[ee] / oldCalibs_[ee]);
346  }
347 
348  } //if
349  } //iy
350  } //ix
351 
352  } // sides
353 
354  barreletamap.Write();
355  barreletamapraw.Write();
356  rawconst_endc_h.Write();
357  const_endc_h.Write();
358  oldconst_endc_h.Write();
359  newvsraw_endc_h.Write();
360  barrelmapold.Write();
361  barrelmapnew.Write();
362  barrelmapratio.Write();
363  endcapmapold_plus.Write();
364  endcapmapnew_plus.Write();
365  endcapmapratio_plus.Write();
366  endcapmapold_minus.Write();
367  endcapmapnew_minus.Write();
368  endcapmapratio_minus.Write();
369 
370  f.Close();
371 }
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]
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 375 of file PhiSymmetryCalibration_step2.cc.

References EcalGeomPhiSymHelper::cellArea_, EcalGeomPhiSymHelper::cellPhi_, EcalGeomPhiSymHelper::cellPos_, e_, EcalGeomPhiSymHelper::endcapRing_, esum_barl_, esum_endc_, esumMean_barl_, esumMean_endc_, PV3DBase< T, PVType, FrameType >::eta(), etsum_barl_, etsum_endc_, etsum_endc_uncorr, etsumMean_barl_, etsumMean_endc_, validate-o2o-wbm::f, EcalGeomPhiSymHelper::goodCell_barl, EcalGeomPhiSymHelper::goodCell_endc, kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, EcalGeomPhiSymHelper::nBads_barl, EcalGeomPhiSymHelper::nBads_endc, nhits_barl_, EcalGeomPhiSymHelper::nRing_, EcalGeomPhiSymHelper::phi_endc_, relativeConstraints::ring, jetcorrextractor::sign(), and submitPVValidationJobs::t.

Referenced by endJob().

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

References correl_barl_histos, correl_endc_histos, validate-o2o-wbm::f, miscal_resid_barl_histos, miscal_resid_endc_histos, and relativeConstraints::ring.

Referenced by endJob().

799  {
800  // output histograms of residual miscalibrations
801  TFile f("PhiSymmetryCalibration_miscal_resid.root", "recreate");
802  for (int ieta = 0; ieta < 85; ieta++) {
803  miscal_resid_barl_histos[ieta]->Write();
804  correl_barl_histos[ieta]->Write();
805 
806  delete miscal_resid_barl_histos[ieta];
807  delete correl_barl_histos[ieta];
808  }
809 
810  for (int ring = 0; ring < 39; ring++) {
811  miscal_resid_endc_histos[ring]->Write();
812  correl_endc_histos[ring]->Write();
813 
815  delete correl_endc_histos[ring];
816  }
817  f.Close();
818 }
std::vector< TH1F * > miscal_resid_endc_histos
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
void PhiSymmetryCalibration_step2::readEtSums ( )

Definition at line 744 of file PhiSymmetryCalibration_step2.cc.

References etsum_barl_, etsum_endc_, recoMuon::in, k_barl_, k_endc_, kBarlRings, kEndcEtaRings, nhits, nhits_barl_, nhits_endc_, relativeConstraints::ring, and jetcorrextractor::sign().

Referenced by beginJob().

744  {
745  //read in ET sums
746 
747  int ieta, iphi, sign, ix, iy, dummy;
748  double etsum;
749  unsigned int nhits;
750  std::ifstream etsum_barl_in("etsum_barl.dat", ios::in);
751  while (etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits) {
752  etsum_barl_[ieta][iphi][sign] += etsum;
753  nhits_barl_[ieta][iphi][sign] += nhits;
754  }
755 
756  std::ifstream etsum_endc_in("etsum_endc.dat", ios::in);
757  while (etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits >> dummy) {
758  etsum_endc_[ix][iy][sign] += etsum;
759  nhits_endc_[ix][iy][sign] += nhits;
760  }
761 
762  std::ifstream k_barl_in("k_barl.dat", ios::in);
763  for (int ieta = 0; ieta < kBarlRings; ieta++) {
764  k_barl_in >> dummy >> k_barl_[ieta];
765  }
766 
767  std::ifstream k_endc_in("k_endc.dat", ios::in);
768  for (int ring = 0; ring < kEndcEtaRings; ring++) {
769  k_endc_in >> dummy >> k_endc_[ring];
770  }
771 }
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 37 of file PhiSymmetryCalibration_step2.cc.

References barrelCells, channelStatusToken_, e_, DetId::Ecal, EcalBarrel, EcalEndcap, endcapCells, relativeConstraints::geometry, geometryToken_, edm::EventSetup::getData(), h, have_initial_miscalib_, initialmiscalibfile_, miscalib_, oldcalibfile_, oldCalibs_, AlCaHLTBitMon_ParallelJobs::p, fed_dqm_sourceclient-live_cfg::path, EcalFloatCondObjectContainerXMLTranslator::readXML(), reiteration_, runTheMatrix::ret, EcalGeomPhiSymHelper::setup(), and statusThreshold_.

Referenced by analyze().

37  {
38  const auto& chStatus = se.getData(channelStatusToken_);
39 
40  const auto& geometry = se.getData(geometryToken_);
41 
42  barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel);
43  endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap);
44 
45  e_.setup(&geometry, &chStatus, statusThreshold_);
46 
50  namespace fs = std::filesystem;
52  if (!fs::exists(p))
53  edm::LogError("PhiSym") << "File not found: " << initialmiscalibfile_ << endl;
54 
56  if (ret)
57  edm::LogError("PhiSym") << "Error reading XML files" << endl;
58  ;
59  } else {
60  for (vector<DetId>::iterator it = barrelCells.begin(); it != barrelCells.end(); ++it) {
61  miscalib_[*it] = 1;
62  }
63 
64  for (vector<DetId>::iterator it = endcapCells.begin(); it != endcapCells.end(); ++it) {
65  miscalib_[*it] = 1;
66  }
67  }
68 
69  // if we are reiterating, read constants from previous iter
70  // if not put them to one
71  if (reiteration_) {
73  namespace fs = std::filesystem;
74  fs::path p(oldcalibfile_.c_str());
75  if (!fs::exists(p))
76  edm::LogError("PhiSym") << "File not found: " << oldcalibfile_ << endl;
77 
79 
80  if (ret)
81  edm::LogError("PhiSym") << "Error reading XML files" << endl;
82  ;
83 
84  } else {
85  for (vector<DetId>::iterator it = barrelCells.begin(); it != barrelCells.end(); ++it)
86  oldCalibs_[*it] = 1;
87 
88  for (vector<DetId>::iterator it = endcapCells.begin(); it != endcapCells.end(); ++it)
89  oldCalibs_[*it] = 1;
90 
91  } // else
92 }
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelStatusToken_
tuple ret
prodAgent to be discontinued
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
Log< level::Error, false > LogError
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void PhiSymmetryCalibration_step2::setupResidHistos ( )

Definition at line 773 of file PhiSymmetryCalibration_step2.cc.

References correl_barl_histos, correl_endc_histos, kBarlRings, kEndcEtaRings, miscal_resid_barl_histos, miscal_resid_endc_histos, and relativeConstraints::ring.

Referenced by beginJob().

773  {
776 
777  for (int ieta = 0; ieta < kBarlRings; ieta++) {
778  ostringstream t1;
779  t1 << "mr_barl_" << ieta + 1;
780  miscal_resid_barl_histos[ieta] = new TH1F(t1.str().c_str(), "", 100, 0., 2.);
781  ostringstream t2;
782  t2 << "co_barl_" << ieta + 1;
783  correl_barl_histos[ieta] = new TH2F(t2.str().c_str(), "", 50, .5, 1.5, 50, .5, 1.5);
784  }
785 
788 
789  for (int ring = 0; ring < kEndcEtaRings; ring++) {
790  ostringstream t1;
791  t1 << "mr_endc_" << ring + 1;
792  miscal_resid_endc_histos[ring] = new TH1F(t1.str().c_str(), "", 100, 0., 2.);
793  ostringstream t2;
794  t2 << "co_endc_" << ring + 1;
795  correl_endc_histos[ring] = new TH2F(t2.str().c_str(), "", 50, .5, 1.5, 50, .5, 1.5);
796  }
797 }
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 69 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and setUp().

const edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> PhiSymmetryCalibration_step2::channelStatusToken_
private

Definition at line 37 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

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

Definition at line 93 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), outResidHistos(), and setupResidHistos().

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

Definition at line 96 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), outResidHistos(), and setupResidHistos().

EcalGeomPhiSymHelper PhiSymmetryCalibration_step2::e_
private

Definition at line 67 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), fillConstantsHistos(), fillHistos(), and setUp().

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

Definition at line 70 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and setUp().

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

Definition at line 64 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob().

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

Definition at line 65 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob().

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

Definition at line 50 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), and fillHistos().

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

Definition at line 51 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), and fillHistos().

double PhiSymmetryCalibration_step2::esumMean_barl_[kBarlRings]
private

Definition at line 53 of file PhiSymmetryCalibration_step2.h.

Referenced by fillHistos().

double PhiSymmetryCalibration_step2::esumMean_endc_[kEndcEtaRings]
private

Definition at line 54 of file PhiSymmetryCalibration_step2.h.

Referenced by fillHistos().

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

Definition at line 41 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), endJob(), fillHistos(), and readEtSums().

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

Definition at line 42 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), endJob(), fillHistos(), and readEtSums().

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

Definition at line 43 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillHistos().

double PhiSymmetryCalibration_step2::etsumMean_barl_[kBarlRings]
private

Definition at line 44 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillHistos().

double PhiSymmetryCalibration_step2::etsumMean_endc_[kEndcEtaRings]
private

Definition at line 45 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillHistos().

bool PhiSymmetryCalibration_step2::firstpass_
private

Definition at line 72 of file PhiSymmetryCalibration_step2.h.

Referenced by analyze(), and endJob().

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> PhiSymmetryCalibration_step2::geometryToken_
private

Definition at line 38 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

const bool PhiSymmetryCalibration_step2::have_initial_miscalib_
private

Definition at line 88 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

const std::string PhiSymmetryCalibration_step2::initialmiscalibfile_
private

Definition at line 89 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

double PhiSymmetryCalibration_step2::k_barl_[kBarlRings]
private

Definition at line 56 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and readEtSums().

double PhiSymmetryCalibration_step2::k_endc_[kEndcEtaRings]
private

Definition at line 57 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and readEtSums().

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

res miscalib histos

Definition at line 92 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), outResidHistos(), and setupResidHistos().

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

Definition at line 95 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), outResidHistos(), and setupResidHistos().

EcalIntercalibConstants PhiSymmetryCalibration_step2::miscalib_
private

initial miscalibration applied if any)

Definition at line 85 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and setUp().

EcalIntercalibConstants PhiSymmetryCalibration_step2::newCalibs_
private

calib constants that we are going to calculate

Definition at line 82 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillConstantsHistos().

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

Definition at line 47 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), fillHistos(), and readEtSums().

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

Definition at line 48 of file PhiSymmetryCalibration_step2.h.

Referenced by beginJob(), and readEtSums().

const std::string PhiSymmetryCalibration_step2::oldcalibfile_
private

Definition at line 76 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

EcalIntercalibConstants PhiSymmetryCalibration_step2::oldCalibs_
private

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

Definition at line 79 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), fillConstantsHistos(), and setUp().

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

Definition at line 60 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillConstantsHistos().

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

Definition at line 61 of file PhiSymmetryCalibration_step2.h.

Referenced by endJob(), and fillConstantsHistos().

const bool PhiSymmetryCalibration_step2::reiteration_
private

Definition at line 75 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().

const int PhiSymmetryCalibration_step2::statusThreshold_
private

Definition at line 73 of file PhiSymmetryCalibration_step2.h.

Referenced by setUp().