19 #include <boost/ref.hpp>
20 #include <boost/bind.hpp>
21 #include <boost/function.hpp>
22 #include <boost/iterator/transform_iterator.hpp>
40 namespace ecalpulseshape {
41 enum Quantity {
sample_0=1,
sample_1=2,
sample_2=3,
sample_3=4,
sample_4=5,
sample_5=6,
sample_6=7,
sample_7=8,
sample_8=9,
sample_9=10,
sample_10=11,
sample_11=12 };
45 return std::accumulate(
53 result[0] =
average(pulseshapes,q);
61 for (
unsigned int i=0;
i<which.size();
i++) {
63 if ((
unsigned int) (which[
i])< pulseshapes.
barrelItems().size())
64 result.push_back( pulseshapes.
barrelItems()[which[
i]].val(q-1));
68 typedef boost::function<void(EcalPulseShapes const & pulseshapes, Quantity q, std::vector<int>
const & which, std::vector<float> &
result)>
PulseShapeExtractor;
80 std::vector<int>
const &
which()
const {
return m_which;}
115 std::vector<float> res;
116 extractor(m_what.how())(it,m_what.quantity(),m_what.which(),res);
129 std::stringstream
ss;
148 for(std::vector<EcalPulseShape>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems) {
157 std::stringstream
ss;
168 std::vector<int>
const&,
169 std::vector<float>
const& )
const {
170 gStyle->SetPalette(1);
172 TCanvas
canvas(
"CC map",
"CC map",800,1200);
174 float xmi[3] = {0.0 , 0.22, 0.78};
175 float xma[3] = {0.22, 0.78, 1.00};
176 TPad*** pad =
new TPad**[6];
177 for (
int s = 0;
s < 6;
s++) {
178 pad[
s] =
new TPad*[3];
180 float yma = 1.- (0.17 *
s);
181 float ymi = yma - 0.15;
182 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
s),Form(
"p_%i_%i",
obj,
s),
183 xmi[
obj], ymi, xma[obj], yma);
198 barrel_s[
s] =
new TH2F(Form(
"EBs%i",
s),Form(
"sample %i EB",
s),360,0,360, 170, -85,85);
199 endc_p_s[
s] =
new TH2F(Form(
"EE+s%i",
s),Form(
"sample %i EE+",
s),100,1,101,100,1,101);
200 endc_m_s[
s] =
new TH2F(Form(
"EE-s%i",
s),Form(
"sample %i EE-",
s),100,1,101,100,1,101);
204 int thesign =
sign==1 ? 1:-1;
208 EBDetId id((ieta+1)*thesign, iphi+1);
210 if(
sign == 1) y = ieta;
212 barrel_s[
s]->Fill(iphi, y,
object()[
id.rawId()].pdfval[
s]);
223 endc_p_s[
s]->
Fill(ix+1,iy+1,
object()[
id.rawId()].pdfval[
s]);
227 endc_m_s[
s]->
Fill(ix+1,iy+1,
object()[
id.rawId()].pdfval[
s]);
234 TLine*
l =
new TLine(0., 0., 0., 0.);
236 int ixSectorsEE[202] = {
237 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
238 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
239 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
240 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
241 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
242 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
243 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
244 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
245 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
246 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
248 int iySectorsEE[202] = {
249 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
250 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
251 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
252 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
253 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
254 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
255 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
256 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
257 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
258 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
262 for(
int s = 0;
s<7; ++
s) {
268 endc_m_s[
s]->SetStats(0);
269 endc_m_s[
s]->SetMaximum(1);
270 endc_m_s[
s]->SetMinimum(0);
271 endc_m_s[
s]->Draw(
"colz");
272 for (
int i=0;
i<201;
i=
i+1) {
273 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
274 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
275 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
276 ixSectorsEE[i+1], iySectorsEE[i+1]);
277 l->SetLineWidth(0.2);
282 barrel_s[
s]->SetStats(0);
283 barrel_s[
s]->SetMaximum(1);
284 barrel_s[
s]->SetMinimum(0);
285 barrel_s[
s]->Draw(
"colz");
286 for(
int i = 0;
i <17;
i++) {
287 Double_t
x = 20.+ (
i *20);
288 l =
new TLine(x,-85.,x,86.);
290 l->SetLineWidth(0.2);
292 l =
new TLine(0.,0.,360.,0.);
296 endc_p_s[
s]->SetStats(0);
297 endc_p_s[
s]->SetMaximum(1);
298 endc_p_s[
s]->SetMinimum(0);
299 endc_p_s[
s]->Draw(
"colz");
300 for (
int i=0;
i<201;
i=
i+1) {
301 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
302 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
303 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
304 ixSectorsEE[i+1], iySectorsEE[i+1]);
305 l->SetLineWidth(0.2);
311 canvas.SaveAs(filename.c_str());
316 namespace condPython {
319 using namespace boost::python;
320 enum_<cond::ecalpulseshape::Quantity>(
"Quantity")
332 enum_<cond::ecalpulseshape::How>(
"How")
339 class_<What>(
"What",init<>())
340 .def(
"set_quantity",&What::set_quantity)
341 .def(
"set_how",&What::set_how)
342 .def(
"set_which",&What::set_which)
343 .def(
"quantity",&What::quantity, return_value_policy<copy_const_reference>())
344 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
345 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
float average(EcalPulseShapes const &pulseshapes, Quantity q)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
static const int kBarlRings
const Items & barrelItems() const
std::vector< std::pair< std::string, float > > type_vValues
static const int TEMPLATESAMPLES
#define PYTHON_WRAPPER(_class, _name)
boost::function< void(EcalPulseShapes const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)> PulseShapeExtractor
unsigned int total_values
type_vValues getValues(const std::vector< EcalPulseShape > &vItems) override
static const int kBarlWedges
U second(std::pair< T, U > const &p)
T x() const
Cartesian x coordinate.
std::string summary() const
static const int kEndcWedgesX
float val(int isample) const
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static const int MAX_IPHI
void extractSuperModules(EcalPulseShapes const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)
void extractSingleChannel(EcalPulseShapes const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
void defineWhat< EcalPulseShapes >()
std::string printBarrelsEndcaps(const std::vector< T > &barrelItems, const std::vector< T > &endcapItems)
static std::string dumpXML(const EcalCondHeader &header, const EcalPulseShapes &record)
void extractAverage(EcalPulseShapes const &pulseshapes, Quantity q, std::vector< int > const &, std::vector< float > &result)
EcalPulseShape EcalObject
static const int kEndcWedgesY