20 #include <boost/ref.hpp>
21 #include <boost/bind.hpp>
22 #include <boost/function.hpp>
23 #include <boost/iterator/transform_iterator.hpp>
30 void doB(
float const & item) {
31 ss <<
i <<
":"<< item <<
"\n";
34 void doE(
float const & item) {
35 ss <<
i <<
":"<< item <<
"\n";
56 result.resize(cont.barrelItems().size());
57 std::copy(cont.barrelItems().begin(),cont.barrelItems().end(),result.begin());
61 result.resize(cont.endcapItems().size());
62 std::copy(cont.endcapItems().begin(),cont.endcapItems().end(),result.begin());
65 void extractAll(
Container const & cont, std::vector<int>
const &, std::vector<float> & result) {
68 result.resize(cont.barrelItems().size()+ cont.endcapItems().size());
70 std::copy(cont.barrelItems().begin(),cont.barrelItems().end(),result.begin());
71 std::copy(cont.endcapItems().begin(),cont.endcapItems().end(),result.end());
79 result.reserve(which.size());
80 for (
unsigned int i=0;
i<which.size();
i++) {
81 result.push_back(cont[which[
i]]);
85 typedef boost::function<void(Container const & cont, std::vector<int>
const & which, std::vector<float> &
result)>
CondExtractor;
93 std::vector<int> m_which;
96 std::vector<int>
const &
which()
const {
return m_which;}
106 class ValueExtractor<ecalcond::
Container>:
public BaseValueExtractor<ecalcond::Container> {
134 std::vector<float> res;
135 extractor(m_what.how())(it,m_what.which(),res);
149 std::stringstream
ss;
166 std::stringstream
ss;
187 int thesign =
sign==1 ? 1:-1;
191 EBDetId id((ieta+1)*thesign, iphi+1);
194 mean_x_EB=mean_x_EB+
x;
195 mean_xx_EB=mean_xx_EB+x*
x;
205 mean_x_EE=mean_x_EE+
x;
206 mean_xx_EE=mean_xx_EE+x*
x;
214 mean_x_EB=mean_x_EB/num_x_EB;
215 mean_x_EE=mean_x_EE/num_x_EE;
216 mean_xx_EB=mean_xx_EB/num_x_EB;
217 mean_xx_EE=mean_xx_EE/num_x_EE;
218 float rms_EB=(mean_xx_EB-mean_x_EB*mean_x_EB);
219 float rms_EE=(mean_xx_EE-mean_x_EE*mean_x_EE);
221 ss <<
"ECAL BARREL Mean: "<< mean_x_EB <<
" RMS: "<< rms_EB <<
" Nchan: "<< num_x_EB<< std::endl
222 <<
"ECAL Endcap Mean: "<< mean_x_EE <<
" RMS: "<< rms_EE <<
" Nchan: "<< num_x_EE<< std::endl ;
233 std::vector<int>
const&,
234 std::vector<float>
const& )
const {
236 gStyle->SetPalette(1);
237 TCanvas
canvas(
"CC map",
"CC map",840,280);
240 TPad pad1(
"p1",
"p1", 0.0, 0.0, 0.2, 1.0);
241 TPad pad2(
"p2",
"p2", 0.2, 0.0, 0.8, 1.0);
242 TPad pad3(
"p3",
"p3", 0.8, 0.0, 1.0, 1.0);
247 TH2F barrelmap(
"EB",
"EB",360,1,360, 171, -85,86);
248 TH2F endcmap_p(
"EE+",
"EE+",100,1,101,100,1,101);
249 TH2F endcmap_m(
"EE-",
"EE-",100,1,101,100,1,101);
260 int thesign =
sign==1 ? 1:-1;
264 EBDetId id((ieta+1)*thesign, iphi+1);
265 barrelmap.Fill(iphi+1,ieta*thesign + thesign,
object()[
id.rawId()]);
275 endcmap_p.Fill(ix+1,iy+1,
object()[
id.rawId()]);
278 endcmap_m.Fill(ix+1,iy+1,
object()[
id.rawId()]);
291 endcmap_m.SetStats(0);
292 endcmap_m.Draw(
"colz");
295 barrelmap.SetStats(0);
296 barrelmap.Draw(
"colz");
299 endcmap_p.SetStats(0);
300 endcmap_p.Draw(
"colz");
302 canvas.SaveAs(filename.c_str());
309 namespace condPython {
311 void defineWhat<cond::ecalcond::Container>() {
312 using namespace boost::python;
313 enum_<cond::ecalcond::How>(
"How")
322 class_<What>(
"What",init<>())
323 .def(
"set_how",&What::set_how)
324 .def(
"set_which",&What::set_which)
325 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
326 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
void extractSuperModules(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
tuple cont
load Luminosity info ##
EcalChannelStatus Container
static const int kBarlRings
boost::function< void(Container const &cont, std::vector< int > const &which, std::vector< float > &result)> CondExtractor
#define PYTHON_WRAPPER(_class, _name)
static const int kBarlWedges
std::string summary() const
static const int kEndcWedgesX
static std::string dumpXML(const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
Container::value_type value_type
static const int MAX_IPHI
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
void extractSingleChannel(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
void extractBarrel(Container const &cont, std::vector< int > const &, std::vector< float > &result)
void reset(double vett[256])
void extractEndcap(Container const &cont, std::vector< int > const &, std::vector< float > &result)
void extractAll(Container const &cont, std::vector< int > const &, std::vector< float > &result)
static const int kEndcWedgesY