20 #include <boost/ref.hpp>
21 #include <boost/bind.hpp>
22 #include <boost/function.hpp>
23 #include <boost/iterator/transform_iterator.hpp>
44 namespace ecalpulsecovariance {
45 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 };
49 return std::accumulate(
57 result[0] =
average(pulseshapes,q);
65 for (
unsigned int i=0;
i<which.size();
i++) {
67 if ((
unsigned int) (which[
i])< pulseshapes.
barrelItems().size())
72 typedef boost::function<void(EcalPulseCovariances const & pulseshapes, Quantity q, std::vector<int>
const & which, std::vector<float> &
result)>
PulseCovarianceExtractor;
84 std::vector<int>
const &
which()
const {
return m_which;}
119 std::vector<float> res;
120 extractor(m_what.how())(it,m_what.quantity(),m_what.which(),res);
133 std::stringstream
ss;
152 for(std::vector<EcalPulseCovariance>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems) {
161 std::stringstream
ss;
172 std::vector<int>
const&,
173 std::vector<float>
const& )
const {
174 gStyle->SetPalette(1);
176 TCanvas
canvas(
"CC map",
"CC map",800,1200);
178 float xmi[3] = {0.0 , 0.22, 0.78};
179 float xma[3] = {0.22, 0.78, 1.00};
180 TPad*** pad =
new TPad**[6];
181 for (
int s = 0;
s < 6;
s++) {
182 pad[
s] =
new TPad*[3];
184 float yma = 1.- (0.17 *
s);
185 float ymi = yma - 0.15;
186 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
s),Form(
"p_%i_%i",
obj,
s),
187 xmi[
obj], ymi, xma[obj], yma);
202 barrel_s[
s] =
new TH2F(Form(
"EBs%i",
s),Form(
"sample %i EB",
s),360,0,360, 170, -85,85);
203 endc_p_s[
s] =
new TH2F(Form(
"EE+s%i",
s),Form(
"sample %i EE+",
s),100,1,101,100,1,101);
204 endc_m_s[
s] =
new TH2F(Form(
"EE-s%i",
s),Form(
"sample %i EE-",
s),100,1,101,100,1,101);
208 int thesign =
sign==1 ? 1:-1;
212 EBDetId id((ieta+1)*thesign, iphi+1);
214 if(
sign == 1) y = ieta;
216 barrel_s[
s]->Fill(iphi, y, fabs(
object()[
id.rawId()].covval[
THERAW][
s]));
227 endc_p_s[
s]->
Fill(ix+1,iy+1,fabs(
object()[
id.rawId()].covval[
THERAW][
s]));
231 endc_m_s[
s]->
Fill(ix+1,iy+1,fabs(
object()[
id.rawId()].covval[
THERAW][
s]));
238 TLine*
l =
new TLine(0., 0., 0., 0.);
240 int ixSectorsEE[202] = {
241 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
242 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
243 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
244 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
245 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
246 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
247 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
248 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
249 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
250 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
252 int iySectorsEE[202] = {
253 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
254 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
255 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
256 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
257 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
258 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
259 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
260 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
261 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
262 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
266 for(
int s = 0;
s<7; ++
s) {
272 pad[ipad][0]->SetLogz(1);
273 endc_m_s[
s]->SetStats(0);
274 endc_m_s[
s]->SetMaximum(1.0);
275 endc_m_s[
s]->SetMinimum(1.0
e-7);
276 endc_m_s[
s]->Draw(
"colz");
277 for (
int i=0;
i<201;
i=
i+1) {
278 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
279 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
280 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
281 ixSectorsEE[i+1], iySectorsEE[i+1]);
282 l->SetLineWidth(0.2);
287 pad[ipad][1]->SetLogz(1);
288 barrel_s[
s]->SetStats(0);
289 barrel_s[
s]->SetMaximum(1.0);
290 barrel_s[
s]->SetMinimum(1.0
e-7);
291 barrel_s[
s]->Draw(
"colz");
292 for(
int i = 0;
i <17;
i++) {
293 Double_t
x = 20.+ (
i *20);
294 l =
new TLine(x,-85.,x,86.);
296 l->SetLineWidth(0.2);
298 l =
new TLine(0.,0.,360.,0.);
302 pad[ipad][2]->SetLogz(1);
303 endc_p_s[
s]->SetStats(0);
304 endc_p_s[
s]->SetMaximum(1.0);
305 endc_p_s[
s]->SetMinimum(1.0
e-7);
306 endc_p_s[
s]->Draw(
"colz");
307 for (
int i=0;
i<201;
i=
i+1) {
308 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
309 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
310 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
311 ixSectorsEE[i+1], iySectorsEE[i+1]);
312 l->SetLineWidth(0.2);
318 canvas.SaveAs(filename.c_str());
323 namespace condPython {
326 using namespace boost::python;
327 enum_<cond::ecalpulsecovariance::Quantity>(
"Quantity")
339 enum_<cond::ecalpulsecovariance::How>(
"How")
346 class_<What>(
"What",init<>())
347 .def(
"set_quantity",&What::set_quantity)
348 .def(
"set_how",&What::set_how)
349 .def(
"set_which",&What::set_which)
350 .def(
"quantity",&What::quantity, return_value_policy<copy_const_reference>())
351 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
352 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
static std::string dumpXML(const EcalCondHeader &header, const EcalPulseCovariances &record)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
EcalPulseCovariancesHelper()
static const int kBarlRings
const Items & barrelItems() const
std::vector< std::pair< std::string, float > > type_vValues
static const int TEMPLATESAMPLES
void defineWhat< EcalPulseCovariances >()
#define PYTHON_WRAPPER(_class, _name)
float val(int i, int j) const
unsigned int total_values
EcalPulseCovariance EcalObject
boost::function< void(EcalPulseCovariances const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)> PulseCovarianceExtractor
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 average(EcalPulseCovariances const &pulseshapes, Quantity q)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void extractAverage(EcalPulseCovariances const &pulseshapes, Quantity q, std::vector< int > const &, std::vector< float > &result)
static const int MAX_IPHI
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
std::string printBarrelsEndcaps(const std::vector< T > &barrelItems, const std::vector< T > &endcapItems)
void extractSingleChannel(EcalPulseCovariances const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)
type_vValues getValues(const std::vector< EcalPulseCovariance > &vItems) override
void extractSuperModules(EcalPulseCovariances const &pulseshapes, Quantity q, std::vector< int > const &which, std::vector< float > &result)
static const int kEndcWedgesY