3#include "FairRootManager.h"
6#include "FairTrackParam.h"
17#include "TClonesArray.h"
46 if (x<0||x>=
fCX)
return;
47 if (y<0||y>=
fCY)
return;
51 Int_t ri=(Int_t)(255.0*r);
52 Int_t gi=(Int_t)(255.0*g);
53 Int_t bi=(Int_t)(255.0*b);
54 static char color[10];
55 sprintf(color,
"#%.2X%.2X%.2X", ri, gi, bi);
56 fC->PutPixel(x, y, color);
61 if (x<0||x>=
fCX)
return;
62 if (y<0||y>=
fCY)
return;
63 fC->PutPixel(x,
fCY-y-1, color);
69 Int_t ri=(Int_t)(255.0*r);
70 Int_t gi=(Int_t)(255.0*g);
71 Int_t bi=(Int_t)(255.0*b);
72 static char color[10];
73 sprintf(color,
"#%.2X%.2X%.2X", ri, gi, bi);
83 for(Int_t x=xi1;x<=xi2;x++)
84 for(Int_t y=yi1;y<=yi2;y++)
85 if (x==xi1||y==yi1||x==xi2||y==yi2)
127 fC->FillRectangle(
"#000000", 0, 0,
fCX,
fCY);
168 fC->WriteImage(name+
".png", TImage::kPng);
187 fC->DrawLine(x1i, y1i, x2i, y2i, color);
192 if (track==-1111)
return;
194 Int_t n=
fPoints->GetEntriesFast();
200 if (pt->GetTrackID()==track)
break;
203 DrawLine(x, y, pt->GetX(), pt->GetY(), color);
240 Double_t px=p->GetPx();
241 Double_t py=p->GetPy();
242 Double_t pz=p->GetPz();
244 return TMath::Sqrt(px*px+py*py+pz*pz);
259 sprintf(stri,
"%.1f", chi2);
260 fC->DrawText(xi, yi, stri, 8, color,
"arialbd.ttf");
263 fC->DrawText(xi, yi,
"-111", 8, color,
"arialbd.ttf");
269 if (
GetP(p)<0.01)
return;
277 sprintf(stri,
"%.2f",
GetP(p));
289 fC->DrawText(x, y, stri, 8, color,
"arialbd.ttf");
301 sprintf(stri,
"%d", p->GetPdgCode());
302 fC->DrawText(xi, yi, stri, 8, color,
"arialbd.ttf");
316 sprintf(stri,
"%.2f", p);
317 fC->DrawText(xi, yi, stri, 8, color,
"arialbd.ttf");
323 Int_t pn=
fPoints->GetEntriesFast();
332 if (p->GetPdgCode()==22)
334 DrawMark(p->GetX(), p->GetY(),
"#00FF00", 1);
338 if (TMath::Abs(p->GetPdgCode())==11)
340 DrawMark(p->GetX(), p->GetY(),
"#FFFF00", 1);
345 if (TMath::Abs(p->GetPdgCode())==2112)
347 DrawMark(p->GetX(), p->GetY(),
"#FF00FF", 1);
352 DrawMark(p->GetX(), p->GetY(),
"#FF0000", 1);
360 list<ecalDrawerItem*>::const_iterator p;
361 list<ecalCell*> clusters;
362 list<ecalCell*> maximums;
363 list<ecalCell*>::const_iterator cp;
367 std::map<Int_t, Float_t>::const_iterator p1;
384 for(j=0;j<cl->
Size();j++)
386 for(j=0;j<cl->
Maxs();j++)
393 (*p)->fG=c->GetEnergy();
440 if (max<(*p)->fR) max=(*p)->fR;
441 if (max<(*p)->fG) max=(*p)->fG;
442 if (max<(*p)->fB) max=(*p)->fB;
458 Float_t l=(*p)->fG; l=TMath::Sqrt(l);
460 Float_t b=((*p)->fG-(*p)->fB)/((*p)->fG+(*p)->fB);
461 if ((*p)->fB==0) { b=0; }
467 LabToRGB(l, b, a, (*p)->fR, (*p)->fG, (*p)->fB);
472 if (find(clusters.begin(), clusters.end(), (*p)->fCell)==clusters.end())
473 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
476 if (find(clusters.begin(), clusters.end(), (*p)->fCell)!=clusters.end())
477 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
480 if (find(maximums.begin(), maximums.end(), (*p)->fCell)!=maximums.end())
481 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
490 FairRootManager* io=FairRootManager::Instance();
493 Fatal(
"Init",
"Can't find IOManager.");
496 fMCTracks=(TClonesArray*)io->GetObject(
"MCTrack");
499 Fatal(
"Init",
"Can't find array of MC tracks");
502 fPoints=(TClonesArray*)io->GetObject(
"EcalPoint");
505 Fatal(
"Init",
"Can't find array of Ecal Points");
511 Fatal(
"Init",
"Can't find calorimeter structure for drawing");
514 fClusters=(TClonesArray*)io->GetObject(
"EcalClusters");
517 Fatal(
"Init",
"Can't find array of calorimeter clusters");
526 list<ecalCell*> cells;
527 list<ecalCell*>::const_iterator p;
529 for(p=cells.begin();p!=cells.end();++p)
531 fTxt->SetTextFont(43);
532 fTxt->SetTextSizePixels(8);
533 fTxt->SetTextAlign(21);
542 if (
fPoints==NULL)
return -1111;
544 if (
fStr==NULL)
return -1111;
554 list<ecalCell*> cells;
555 list<ecalCell*>::const_iterator p;
557 for(p=cells.begin();p!=cells.end();++p)
559 fTxt->SetTextFont(43);
560 fTxt->SetTextSizePixels(8);
561 fTxt->SetTextAlign(21);
575 list<ecalDrawerItem*>::const_iterator p=
fCells.begin();
583 : FairTask(name, iVerbose),
Int_t PeakNum(Int_t i) const
Int_t CellNum(Int_t i) const
ecalDrawerItem(ecalCell *cell, Float_t r, Float_t g, Float_t b)
void PutPixel(Int_t x, Int_t y, Float_t r, Float_t g, Float_t b)
Int_t InitPython(TClonesArray *mctracks, TClonesArray *ecalPoints, ecalStructure *structure, TClonesArray *clusters)
void DrawEnergy(ecalPoint *p, const char *color)
void DrawMark(Double_t x, Double_t y, const char *color, Int_t type)
void DrawChi2(Float_t x, Float_t y, Float_t chi2, const char *color)
void DrawLine(Double_t x, Double_t y, const char *color, Int_t track)
virtual void Exec(Option_t *option)
std::list< ecalDrawerItem * > fCells
Double_t GetP(ecalPoint *p)
void DrawCell(ecalCell *cell, Float_t r, Float_t g, Float_t b)
virtual InitStatus Init()
void DrawPDG(ecalPoint *p, const char *color)
Double_t GetEcalSize(Int_t num) const
void GetCells(std::list< ecalCell * > &cells) const
ecalCell * GetHitCell(const Int_t hitId) const
ecalInf * GetEcalInf() const
void LabToRGB(Float_t L, Float_t a, Float_t b, Float_t &R, Float_t &G, Float_t &B)