SND@LHC Software
Loading...
Searching...
No Matches
ecalDrawer Class Reference

#include <ecalDrawer.h>

Inheritance diagram for ecalDrawer:
Collaboration diagram for ecalDrawer:

Public Member Functions

 ecalDrawer ()
 
 ecalDrawer (const char *name, const Int_t iVerbose=1)
 
virtual ~ecalDrawer ()
 
void SetNamePrefix (const char *prefix)
 
void SetCellSize (Int_t size)
 
Int_t InitPython (TClonesArray *mctracks, TClonesArray *ecalPoints, ecalStructure *structure, TClonesArray *clusters)
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *option)
 
virtual void Finish ()
 

Private Member Functions

void PutPixel (Int_t x, Int_t y, Float_t r, Float_t g, Float_t b)
 
void PutPixel (Int_t x, Int_t y, const char *color)
 
void DrawMark (Double_t x, Double_t y, const char *color, Int_t type)
 
void DrawCell (ecalCell *cell, Float_t r, Float_t g, Float_t b)
 
void DrawCell (ecalCell *cell, const char *color)
 
void DrawLine (Double_t x, Double_t y, const char *color, Int_t track)
 
void DrawLine (Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *color)
 
void DrawEnergy (ecalPoint *p, const char *color)
 
void DrawPDG (ecalPoint *p, const char *color)
 
void DrawEnergy (Float_t x, Float_t y, Float_t p, const char *color)
 
Double_t GetP (ecalPoint *p)
 
void DrawChi2 (Float_t x, Float_t y, Float_t chi2, const char *color)
 
void DrawMC ()
 
void DrawCells ()
 
void DrawImage ()
 
 ecalDrawer (const ecalDrawer &)
 
ecalDraweroperator= (const ecalDrawer &)
 

Private Attributes

TString fNamePrefix
 
TASImage * fC
 
Int_t fCellSize
 
Int_t fCX
 
Int_t fCY
 
Double_t fMaxEnergyDep
 
ecalStructurefStr
 
ecalInffInf
 
TString fEdging
 
TText * fTxt
 
std::list< ecalDrawerItem * > fCells
 
TClonesArray * fMCTracks
 
TClonesArray * fPoints
 
TClonesArray * fClusters
 
TString fInName
 
Int_t fEventN
 
Double_t fX
 
Double_t fY
 
Double_t fZ
 
Double_t fMCX
 
Double_t fMCY
 
Double_t fMCZ
 
Int_t fMCMotherTrN
 
Double_t fE
 
Double_t fMCE
 
Double_t fPX
 
Double_t fPY
 
Double_t fPZ
 
Double_t fMCPX
 
Double_t fMCPY
 
Double_t fMCPZ
 
Double_t fChi2
 
Int_t fPdgCode
 
Double_t fR
 

Detailed Description

Definition at line 28 of file ecalDrawer.h.

Constructor & Destructor Documentation

◆ ecalDrawer() [1/3]

ecalDrawer::ecalDrawer ( )

Default constructor. Requirement of ROOT system

Definition at line 622 of file ecalDrawer.cxx.

623 : FairTask(),
624 fNamePrefix("ecal"),
625 fC(NULL),
626 fCellSize(8),
627 fCX(0),
628 fCY(0),
629 fMaxEnergyDep(0.),
630 fStr(NULL),
631 fInf(NULL),
632 fEdging(""),
633 fTxt(new TText()),
634 fCells(),
635 fMCTracks(NULL),
636 fPoints(NULL),
637 fClusters(NULL),
638 fInName("EcalReco"),
639 fEventN(0),
640 fX(0.),
641 fY(0.),
642 fZ(0.),
643 fMCX(0.),
644 fMCY(0.),
645 fMCZ(0.),
646 fMCMotherTrN(0),
647 fE(0.),
648 fMCE(0.),
649 fPX(0.),
650 fPY(0.),
651 fPZ(0.),
652 fMCPX(0.),
653 fMCPY(0.),
654 fMCPZ(0.),
655 fChi2(0.),
656 fPdgCode(0),
657 fR(0.)
658{
659}
Double_t fMCZ
Definition ecalDrawer.h:104
Double_t fMaxEnergyDep
Definition ecalDrawer.h:59
Double_t fMCX
Definition ecalDrawer.h:102
TClonesArray * fMCTracks
Definition ecalDrawer.h:92
Double_t fE
Definition ecalDrawer.h:107
Double_t fX
Definition ecalDrawer.h:99
TClonesArray * fClusters
Definition ecalDrawer.h:94
TString fEdging
Definition ecalDrawer.h:63
Double_t fR
Definition ecalDrawer.h:119
ecalInf * fInf
Definition ecalDrawer.h:62
TString fNamePrefix
Definition ecalDrawer.h:51
Double_t fChi2
Definition ecalDrawer.h:115
Double_t fY
Definition ecalDrawer.h:100
Int_t fCX
Definition ecalDrawer.h:55
Int_t fCellSize
Definition ecalDrawer.h:54
TText * fTxt
Definition ecalDrawer.h:83
Double_t fPY
Definition ecalDrawer.h:110
Double_t fPX
Definition ecalDrawer.h:109
Int_t fEventN
Definition ecalDrawer.h:97
Double_t fMCE
Definition ecalDrawer.h:108
ecalStructure * fStr
Definition ecalDrawer.h:61
Double_t fZ
Definition ecalDrawer.h:101
TClonesArray * fPoints
Definition ecalDrawer.h:93
Double_t fMCPY
Definition ecalDrawer.h:113
std::list< ecalDrawerItem * > fCells
Definition ecalDrawer.h:89
Int_t fCY
Definition ecalDrawer.h:56
Double_t fMCPX
Definition ecalDrawer.h:112
TString fInName
Definition ecalDrawer.h:95
Int_t fMCMotherTrN
Definition ecalDrawer.h:105
Double_t fMCY
Definition ecalDrawer.h:103
TASImage * fC
Definition ecalDrawer.h:53
Double_t fPZ
Definition ecalDrawer.h:111
Int_t fPdgCode
Definition ecalDrawer.h:117
Double_t fMCPZ
Definition ecalDrawer.h:114

◆ ecalDrawer() [2/3]

ecalDrawer::ecalDrawer ( const char *  name,
const Int_t  iVerbose = 1 
)

Standard constructor

Definition at line 582 of file ecalDrawer.cxx.

583 : FairTask(name, iVerbose),
584 fNamePrefix("ecal"),
585 fC(NULL),
586 fCellSize(8),
587 fCX(0),
588 fCY(0),
589 fMaxEnergyDep(0.),
590 fStr(NULL),
591 fInf(NULL),
592 fEdging(""),
593 fTxt(new TText()),
594 fCells(),
595 fMCTracks(NULL),
596 fPoints(NULL),
597 fClusters(NULL),
598 fInName("EcalReco"),
599 fEventN(0),
600 fX(0.),
601 fY(0.),
602 fZ(0.),
603 fMCX(0.),
604 fMCY(0.),
605 fMCZ(0.),
606 fMCMotherTrN(0),
607 fE(0.),
608 fMCE(0.),
609 fPX(0.),
610 fPY(0.),
611 fPZ(0.),
612 fMCPX(0.),
613 fMCPY(0.),
614 fMCPZ(0.),
615 fChi2(0.),
616 fPdgCode(0),
617 fR(0.)
618{
619}

◆ ~ecalDrawer()

ecalDrawer::~ecalDrawer ( )
virtual

Destructor

Definition at line 573 of file ecalDrawer.cxx.

574{
575 list<ecalDrawerItem*>::const_iterator p=fCells.begin();
576 for(;p!=fCells.end();++p)
577 delete (*p);
578 delete fTxt;
579}

◆ ecalDrawer() [3/3]

ecalDrawer::ecalDrawer ( const ecalDrawer )
private

Member Function Documentation

◆ DrawCell() [1/2]

void ecalDrawer::DrawCell ( ecalCell cell,
const char *  color 
)
private

Definition at line 77 of file ecalDrawer.cxx.

78{
79 Int_t xi1=(Int_t)((cell->X1()/fInf->GetEcalSize(0))*fCX+fCX/2.0);
80 Int_t xi2=(Int_t)((cell->X2()/fInf->GetEcalSize(0))*fCX+fCX/2.0);
81 Int_t yi1=(Int_t)((cell->Y1()/fInf->GetEcalSize(1))*fCY+fCY/2.0);
82 Int_t yi2=(Int_t)((cell->Y2()/fInf->GetEcalSize(1))*fCY+fCY/2.0);
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)
86 PutPixel(x, y, fEdging);
87 else
88 PutPixel(x, y, color);
89
90}
Float_t X2() const
Definition ecalCell.h:29
Float_t Y2() const
Definition ecalCell.h:30
Float_t Y1() const
Definition ecalCell.h:28
Float_t X1() const
Definition ecalCell.h:27
void PutPixel(Int_t x, Int_t y, Float_t r, Float_t g, Float_t b)
Double_t GetEcalSize(Int_t num) const
Definition ecalInf.h:54

◆ DrawCell() [2/2]

void ecalDrawer::DrawCell ( ecalCell cell,
Float_t  r,
Float_t  g,
Float_t  b 
)
private

draw cell with filled color. fEdging used as egding of cell

Definition at line 67 of file ecalDrawer.cxx.

68{
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);
74 DrawCell(cell, color);
75}
void DrawCell(ecalCell *cell, Float_t r, Float_t g, Float_t b)

◆ DrawCells()

void ecalDrawer::DrawCells ( )
private

Normalization

At the moment B — reconstructed energy G — energy deposited in cell R — energy deposited by photons and their e+/e- daughters

Drawing

Definition at line 358 of file ecalDrawer.cxx.

359{
360 list<ecalDrawerItem*>::const_iterator p;
361 list<ecalCell*> clusters;
362 list<ecalCell*> maximums;
363 list<ecalCell*>::const_iterator cp;
364 ShipMCTrack* tr;
365 ShipMCTrack* tq;
366 Float_t max;
367 std::map<Int_t, Float_t>::const_iterator p1;
368 ecalCellMC* c;
369 Int_t rn=fClusters->GetEntriesFast();
370 Int_t i;
371 Int_t j;
372 Float_t x;
373 Float_t y;
374 Float_t dx;
375 Float_t dy;
376 Float_t rad;
377 Float_t phi;
378
379 clusters.clear();
380
381 for(i=0;i<rn;i++)
382 {
383 ecalCluster* cl=(ecalCluster*)fClusters->At(i);
384 for(j=0;j<cl->Size();j++)
385 clusters.push_back(fStr->GetHitCell(cl->CellNum(j)));
386 for(j=0;j<cl->Maxs();j++)
387 maximums.push_back(fStr->GetHitCell(cl->PeakNum(j)));
388 }
389
390 for(p=fCells.begin();p!=fCells.end();++p)
391 {
392 c=(ecalCellMC*)((*p)->fCell);
393 (*p)->fG=c->GetEnergy();
394 (*p)->fR=0;
395 (*p)->fB=0;
396 }
397/*
398 for(p=fCells.begin();p!=fCells.end();++p)
399 {
400 c=(ecalCellMC*)((*p)->fCell);
401 (*p)->fG=c->GetEnergy();
402 (*p)->fR=0;
403 (*p)->fB=0;
404 for(p1=c->GetTrackEnergyBegin();p1!=c->GetTrackEnergyEnd();++p1)
405 {
406 tr=(ShipMCTrack*)fMCTracks->At(p1->first);
407 if (tr==NULL) continue;
408 if (tr->GetPdgCode()==22)
409 (*p)->fR+=p1->second;
410 else
411 if (tr->GetMotherId()>=0)
412 {
413 tq=(ShipMCTrack*)fMCTracks->At(tr->GetMotherId());
414 if (tr->GetMotherId()==22)
415 (*p)->fR+=p1->second;
416 }
417 }
418 if (find(clusters.begin(), clusters.end(), c)==clusters.end())
419 continue;
420 for(i=0;i<rn;i++)
421 {
422 r=(CbmEcalRecParticle*)fReco->At(i);
423 dx=x=c->GetCenterX();
424 dy=y=c->GetCenterY();
425 dx-=r->X();
426 dy-=r->Y();
427 if (TMath::Abs(dx)>30) continue;
428 if (TMath::Abs(dy)>30) continue;
429 rad=TMath::Sqrt(x*x+y*y);
430 phi=TMath::ACos(x/rad)*TMath::RadToDeg();
431 if (y<0) phi=360-phi;
432// (*p)->fB+=fShLib->GetResponse(dx, dy, phi, TMath::ATan(rad/fInf->GetZPos())*TMath::RadToDeg(), c->GetType());
433 }
434 }
435*/
437 max=0;
438 for(p=fCells.begin();p!=fCells.end();++p)
439 {
440 if (max<(*p)->fR) max=(*p)->fR;
441 if (max<(*p)->fG) max=(*p)->fG;
442 if (max<(*p)->fB) max=(*p)->fB;
443 }
444 if (max>0)
445 for(p=fCells.begin();p!=fCells.end();++p)
446 {
447 (*p)->fR/=max;
448 (*p)->fG/=max;
449 (*p)->fB/=max;
450 }
451
456 for(p=fCells.begin();p!=fCells.end();++p)
457 {
458 Float_t l=(*p)->fG; l=TMath::Sqrt(l);
459 Float_t a=0;
460 Float_t b=((*p)->fG-(*p)->fB)/((*p)->fG+(*p)->fB);
461 if ((*p)->fB==0) { b=0; }
462 else
463 {
464 if (b<-0.7) b=-0.7;
465 if (b>0.7) b=0.7;
466 }
467 LabToRGB(l, b, a, (*p)->fR, (*p)->fG, (*p)->fB);
468 }
470 fEdging="#FFFFFF";
471 for(p=fCells.begin();p!=fCells.end();++p)
472 if (find(clusters.begin(), clusters.end(), (*p)->fCell)==clusters.end())
473 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
474 fEdging="#FF0000";
475 for(p=fCells.begin();p!=fCells.end();++p)
476 if (find(clusters.begin(), clusters.end(), (*p)->fCell)!=clusters.end())
477 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
478 fEdging="#00FF00";
479 for(p=fCells.begin();p!=fCells.end();++p)
480 if (find(maximums.begin(), maximums.end(), (*p)->fCell)!=maximums.end())
481 DrawCell((*p)->fCell, (*p)->fR, (*p)->fG, (*p)->fB);
482}
Int_t Maxs() const
Definition ecalCluster.h:37
Int_t Size() const
Definition ecalCluster.h:35
Int_t PeakNum(Int_t i) const
Definition ecalCluster.h:59
Int_t CellNum(Int_t i) const
Definition ecalCluster.h:58
ecalCell * GetHitCell(const Int_t hitId) const
void LabToRGB(Float_t L, Float_t a, Float_t b, Float_t &R, Float_t &G, Float_t &B)
Definition ecalDrawer.h:129
int i
Definition ShipAna.py:86
int rad
Definition hepunit.py:76
c
Definition hnl.py:100

◆ DrawChi2()

void ecalDrawer::DrawChi2 ( Float_t  x,
Float_t  y,
Float_t  chi2,
const char *  color 
)
private

Draw chi2 for photons

Definition at line 248 of file ecalDrawer.cxx.

249{
250 char stri[30];
251 Int_t xi=(Int_t)((x/fInf->GetEcalSize(0))*fCX+fCX/2.0);
252 Int_t yi=(Int_t)((y/fInf->GetEcalSize(1))*fCY+fCY/2.0);
253 yi-=8;
254 yi=fCY-yi-1;
255 xi-=6;
256
257 if (chi2!=-1111)
258 {
259 sprintf(stri,"%.1f", chi2);
260 fC->DrawText(xi, yi, stri, 8, color, "arialbd.ttf");
261 }
262 else
263 fC->DrawText(xi, yi, "-111", 8, color, "arialbd.ttf");
264}

◆ DrawEnergy() [1/2]

void ecalDrawer::DrawEnergy ( ecalPoint p,
const char *  color 
)
private

Draw energy for given point

Definition at line 267 of file ecalDrawer.cxx.

268{
269 if (GetP(p)<0.01) return;
270 char stri[10];
271 Int_t x=(Int_t)((p->GetX()/fInf->GetEcalSize(0))*fCX+fCX/2.0);
272 Int_t y=(Int_t)((p->GetY()/fInf->GetEcalSize(1))*fCY+fCY/2.0);
273 y+=9;
274 y=fCY-y-1;
275 x-=6;
276
277 sprintf(stri,"%.2f", GetP(p));
278 if (stri[0]=='0')
279 {
280 x+=2;
281 stri[0]=stri[1];
282 stri[1]=stri[2];
283 stri[2]=stri[3];
284 stri[3]=stri[4];
285 stri[4]=stri[5];
286 stri[5]=stri[6];
287 stri[6]=stri[7];
288 }
289 fC->DrawText(x, y, stri, 8, color, "arialbd.ttf");
290}
Double_t GetP(ecalPoint *p)

◆ DrawEnergy() [2/2]

void ecalDrawer::DrawEnergy ( Float_t  x,
Float_t  y,
Float_t  p,
const char *  color 
)
private

Definition at line 306 of file ecalDrawer.cxx.

307{
308 if (p<0.01) return;
309 char stri[10];
310 Int_t xi=(Int_t)((x/fInf->GetEcalSize(0))*fCX+fCX/2.0);
311 Int_t yi=(Int_t)((y/fInf->GetEcalSize(1))*fCY+fCY/2.0);
312 yi-=2;
313 yi=fCY-yi-1;
314 xi-=6;
315
316 sprintf(stri,"%.2f", p);
317 fC->DrawText(xi, yi, stri, 8, color, "arialbd.ttf");
318}

◆ DrawImage()

void ecalDrawer::DrawImage ( )
private

some beauty

Definition at line 120 of file ecalDrawer.cxx.

121{
122 TString name=fNamePrefix;
123 if (fEventN<10) name+="0";
124 if (fEventN<100) name+="0";
125 if (fEventN<1000) name+="0";
126 name+=fEventN;
127 fC->FillRectangle("#000000", 0, 0, fCX, fCY);
128 fEdging="#FFFFFF";
129 DrawCells();
130 DrawMC();
131// DrawTracks();
132// DrawPhotons();
134 /*
135 PutPixel((Int_t)(fCX/2.0+ 0), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
136 PutPixel((Int_t)(fCX/2.0+ 0), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
137 PutPixel((Int_t)(fCX/2.0+ 0), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
138 PutPixel((Int_t)(fCX/2.0+ 0), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
139 PutPixel((Int_t)(fCX/2.0+ 1), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
140 PutPixel((Int_t)(fCX/2.0+ 2), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
141 PutPixel((Int_t)(fCX/2.0+ 2), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
142 PutPixel((Int_t)(fCX/2.0+ 2), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
143 PutPixel((Int_t)(fCX/2.0+ 2), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
144 PutPixel((Int_t)(fCX/2.0+ 4), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
145 PutPixel((Int_t)(fCX/2.0+ 4), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
146 PutPixel((Int_t)(fCX/2.0+ 4), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
147 PutPixel((Int_t)(fCX/2.0+ 5), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
148 PutPixel((Int_t)(fCX/2.0+ 5), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
149 PutPixel((Int_t)(fCX/2.0+ 6), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
150 PutPixel((Int_t)(fCX/2.0+ 6), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
151 PutPixel((Int_t)(fCX/2.0+ 6), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
152 PutPixel((Int_t)(fCX/2.0+ 6), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
153 PutPixel((Int_t)(fCX/2.0+ 8), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
154 PutPixel((Int_t)(fCX/2.0+ 8), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
155 PutPixel((Int_t)(fCX/2.0+ 8), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
156 PutPixel((Int_t)(fCX/2.0+ 8), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
157 PutPixel((Int_t)(fCX/2.0+ 8), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
158 PutPixel((Int_t)(fCX/2.0+ 9), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
159 PutPixel((Int_t)(fCX/2.0+ 9), (Int_t)(fCY/2.0+ 6), "#FFFFFF");
160 PutPixel((Int_t)(fCX/2.0+10), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
161 PutPixel((Int_t)(fCX/2.0+10), (Int_t)(fCY/2.0+ 6), "#FFFFFF");
162 PutPixel((Int_t)(fCX/2.0+11), (Int_t)(fCY/2.0+ 0), "#FFFFFF");
163 PutPixel((Int_t)(fCX/2.0+11), (Int_t)(fCY/2.0+ 1), "#FFFFFF");
164 PutPixel((Int_t)(fCX/2.0+11), (Int_t)(fCY/2.0+ 2), "#FFFFFF");
165 PutPixel((Int_t)(fCX/2.0+11), (Int_t)(fCY/2.0+ 3), "#FFFFFF");
166 PutPixel((Int_t)(fCX/2.0+11), (Int_t)(fCY/2.0+ 4), "#FFFFFF");
167 */
168 fC->WriteImage(name+".png", TImage::kPng);
169}
void DrawMC()
void DrawCells()

◆ DrawLine() [1/2]

void ecalDrawer::DrawLine ( Double_t  x,
Double_t  y,
const char *  color,
Int_t  track 
)
private

Definition at line 190 of file ecalDrawer.cxx.

191{
192 if (track==-1111) return;
193 Int_t i=0;
194 Int_t n=fPoints->GetEntriesFast();
195 ecalPoint* pt;
196
197 for(i=0;i<n;i++)
198 {
199 pt=(ecalPoint*)fPoints->At(i);
200 if (pt->GetTrackID()==track) break;
201 }
202 if (i==n) return;
203 DrawLine(x, y, pt->GetX(), pt->GetY(), color);
204}
void DrawLine(Double_t x, Double_t y, const char *color, Int_t track)

◆ DrawLine() [2/2]

void ecalDrawer::DrawLine ( Double_t  x1,
Double_t  y1,
Double_t  x2,
Double_t  y2,
const char *  color 
)
private

Definition at line 171 of file ecalDrawer.cxx.

172{
173 Int_t x1i=(Int_t)((x1/fInf->GetEcalSize(0))*fCX+fCX/2.0);
174 Int_t y1i=(Int_t)((y1/fInf->GetEcalSize(1))*fCY+fCY/2.0);
175 Int_t x2i=(Int_t)((x2/fInf->GetEcalSize(0))*fCX+fCX/2.0);
176 Int_t y2i=(Int_t)((y2/fInf->GetEcalSize(1))*fCY+fCY/2.0);
177 if (x1i<0) x1i=0;
178 if (x1i>=fCX) x1i=fCX-1;
179 if (x2i<0) x2i=0;
180 if (x2i>=fCX) x2i=fCX-1;
181 if (y1i<0) y1i=0;
182 if (y1i>=fCY) y1i=fCY-1;
183 if (y2i<0) y2i=0;
184 if (y2i>=fCY) y2i=fCY-1;
185 y1i=fCY-y1i-1;
186 y2i=fCY-y2i-1;
187 fC->DrawLine(x1i, y1i, x2i, y2i, color);
188}

◆ DrawMark()

void ecalDrawer::DrawMark ( Double_t  x,
Double_t  y,
const char *  color,
Int_t  type 
)
private

type==0 for star, type==1 for square

Definition at line 92 of file ecalDrawer.cxx.

93{
94 Int_t xi=(Int_t)((x/fInf->GetEcalSize(0))*fCX+fCX/2.0);
95 Int_t yi=(Int_t)((y/fInf->GetEcalSize(1))*fCY+fCY/2.0);
96 PutPixel(xi-1, yi-1, color);
97 PutPixel(xi , yi-1, color);
98 PutPixel(xi+1, yi-1, color);
99 PutPixel(xi-1, yi , color);
100 PutPixel(xi , yi , color);
101 PutPixel(xi+1, yi , color);
102 PutPixel(xi-1, yi+1, color);
103 PutPixel(xi , yi+1, color);
104 PutPixel(xi+1, yi+1, color);
105 if (type==1) return;
106 PutPixel(xi-2, yi-2, color);
107 PutPixel(xi+2, yi-2, color);
108 PutPixel(xi-2, yi+2, color);
109 PutPixel(xi+2, yi+2, color);
110 PutPixel(xi , yi-2, color);
111 PutPixel(xi-2, yi , color);
112 PutPixel(xi , yi+2, color);
113 PutPixel(xi+2, yi , color);
114 PutPixel(xi , yi-3, color);
115 PutPixel(xi-3, yi , color);
116 PutPixel(xi , yi+3, color);
117 PutPixel(xi+3, yi , color);
118}

◆ DrawMC()

void ecalDrawer::DrawMC ( )
private

gammas

Neutrons and antineutrons

others

Definition at line 320 of file ecalDrawer.cxx.

321{
322 Int_t i;
323 Int_t pn=fPoints->GetEntriesFast();
324 ecalPoint* p;
325
326
327 for(i=0;i<pn;i++)
328 {
329 p=(ecalPoint*)fPoints->At(i);
330 if (!p) continue;
332 if (p->GetPdgCode()==22)
333 {
334 DrawMark(p->GetX(), p->GetY(), "#00FF00", 1);
335 DrawEnergy(p, "#00FF00");
336 continue;
337 }
338 if (TMath::Abs(p->GetPdgCode())==11)
339 {
340 DrawMark(p->GetX(), p->GetY(), "#FFFF00", 1);
341 DrawEnergy(p, "#FFFF00");
342 continue;
343 }
345 if (TMath::Abs(p->GetPdgCode())==2112)
346 {
347 DrawMark(p->GetX(), p->GetY(), "#FF00FF", 1);
348 DrawEnergy(p, "#FF00FF");
349 continue;
350 }
352 DrawMark(p->GetX(), p->GetY(), "#FF0000", 1);
353 DrawEnergy(p, "#FF0000");
354 DrawPDG(p, "#FF0000");
355 }
356}
void DrawEnergy(ecalPoint *p, const char *color)
void DrawMark(Double_t x, Double_t y, const char *color, Int_t type)
void DrawPDG(ecalPoint *p, const char *color)

◆ DrawPDG()

void ecalDrawer::DrawPDG ( ecalPoint p,
const char *  color 
)
private

Definition at line 292 of file ecalDrawer.cxx.

293{
294 char stri[30];
295 Int_t xi=(Int_t)((p->GetX()/fInf->GetEcalSize(0))*fCX+fCX/2.0);
296 Int_t yi=(Int_t)((p->GetY()/fInf->GetEcalSize(1))*fCY+fCY/2.0);
297 yi-=8;
298 yi=fCY-yi-1;
299 xi-=6;
300
301 sprintf(stri,"%d", p->GetPdgCode());
302 fC->DrawText(xi, yi, stri, 8, color, "arialbd.ttf");
303}

◆ Exec()

void ecalDrawer::Exec ( Option_t *  option)
virtual

Definition at line 38 of file ecalDrawer.cxx.

39{
40 DrawImage();
41 fEventN++;
42}
void DrawImage()

◆ Finish()

void ecalDrawer::Finish ( )
virtual

Definition at line 566 of file ecalDrawer.cxx.

567{
568 ;
569}

◆ GetP()

Double_t ecalDrawer::GetP ( ecalPoint p)
private

Definition at line 238 of file ecalDrawer.cxx.

239{
240 Double_t px=p->GetPx();
241 Double_t py=p->GetPy();
242 Double_t pz=p->GetPz();
243
244 return TMath::Sqrt(px*px+py*py+pz*pz);
245}

◆ Init()

InitStatus ecalDrawer::Init ( )
virtual

Init

Definition at line 485 of file ecalDrawer.cxx.

486{
487 fEventN=0;
488
489
490 FairRootManager* io=FairRootManager::Instance();
491 if (!io)
492 {
493 Fatal("Init", "Can't find IOManager.");
494 return kFATAL;
495 }
496 fMCTracks=(TClonesArray*)io->GetObject("MCTrack");
497 if (!fMCTracks)
498 {
499 Fatal("Init", "Can't find array of MC tracks");
500 return kFATAL;
501 }
502 fPoints=(TClonesArray*)io->GetObject("EcalPoint");
503 if (!fPoints)
504 {
505 Fatal("Init", "Can't find array of Ecal Points");
506 return kFATAL;
507 }
508 fStr=(ecalStructure*)io->GetObject("EcalStructure");
509 if (!fStr)
510 {
511 Fatal("Init", "Can't find calorimeter structure for drawing");
512 return kFATAL;
513 }
514 fClusters=(TClonesArray*)io->GetObject("EcalClusters");
515 if (!fClusters)
516 {
517 Fatal("Init", "Can't find array of calorimeter clusters");
518 return kFATAL;
519 }
522 fCX*=fCellSize*4+4; fCX+=1;
523 fCY*=fCellSize*4+4; fCY+=1;
524 fC=new TASImage(fCX, fCY);
525
526 list<ecalCell*> cells;
527 list<ecalCell*>::const_iterator p;
528 fStr->GetCells(cells);
529 for(p=cells.begin();p!=cells.end();++p)
530 fCells.push_back(new ecalDrawerItem((*p), 0.0, 0.0, 0.0));
531 fTxt->SetTextFont(43);
532 fTxt->SetTextSizePixels(8);
533 fTxt->SetTextAlign(21);
534 return kSUCCESS;
535}
Int_t GetYSize() const
Definition ecalInf.h:46
Int_t GetXSize() const
Definition ecalInf.h:45
void GetCells(std::list< ecalCell * > &cells) const
ecalInf * GetEcalInf() const

◆ InitPython()

Int_t ecalDrawer::InitPython ( TClonesArray *  mctracks,
TClonesArray *  ecalPoints,
ecalStructure structure,
TClonesArray *  clusters 
)

Definition at line 537 of file ecalDrawer.cxx.

538{
539 fMCTracks=mctracks;
540 if (fMCTracks==NULL) return -1111;
541 fPoints=ecalPoints;
542 if (fPoints==NULL) return -1111;
543 fStr=structure;
544 if (fStr==NULL) return -1111;
546 if (fClusters==NULL) return -1111;
547
550 fCX*=fCellSize*4+4; fCX+=1;
551 fCY*=fCellSize*4+4; fCY+=1;
552 fC=new TASImage(fCX, fCY);
553
554 list<ecalCell*> cells;
555 list<ecalCell*>::const_iterator p;
556 fStr->GetCells(cells);
557 for(p=cells.begin();p!=cells.end();++p)
558 fCells.push_back(new ecalDrawerItem((*p), 0.0, 0.0, 0.0));
559 fTxt->SetTextFont(43);
560 fTxt->SetTextSizePixels(8);
561 fTxt->SetTextAlign(21);
562
563 return 0;
564}

◆ operator=()

ecalDrawer & ecalDrawer::operator= ( const ecalDrawer )
private

◆ PutPixel() [1/2]

void ecalDrawer::PutPixel ( Int_t  x,
Int_t  y,
const char *  color 
)
private

Definition at line 59 of file ecalDrawer.cxx.

60{
61 if (x<0||x>=fCX) return;
62 if (y<0||y>=fCY) return;
63 fC->PutPixel(x, fCY-y-1, color);
64}

◆ PutPixel() [2/2]

void ecalDrawer::PutPixel ( Int_t  x,
Int_t  y,
Float_t  r,
Float_t  g,
Float_t  b 
)
private

Definition at line 44 of file ecalDrawer.cxx.

45{
46 if (x<0||x>=fCX) return;
47 if (y<0||y>=fCY) return;
48 if (r<0||r>1)return;
49 if (g<0||g>1)return;
50 if (b<0||b>1)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);
57}

◆ SetCellSize()

void ecalDrawer::SetCellSize ( Int_t  size)
inline

Definition at line 43 of file ecalDrawer.h.

43{fCellSize=size;}

◆ SetNamePrefix()

void ecalDrawer::SetNamePrefix ( const char *  prefix)
inline

Set prefix to name of images File will be named like: prefix0000.png

Definition at line 42 of file ecalDrawer.h.

Member Data Documentation

◆ fC

TASImage* ecalDrawer::fC
private

An image and its size

Definition at line 53 of file ecalDrawer.h.

◆ fCells

std::list<ecalDrawerItem*> ecalDrawer::fCells
private

Definition at line 89 of file ecalDrawer.h.

◆ fCellSize

Int_t ecalDrawer::fCellSize
private

Definition at line 54 of file ecalDrawer.h.

◆ fChi2

Double_t ecalDrawer::fChi2
private

Definition at line 115 of file ecalDrawer.h.

◆ fClusters

TClonesArray* ecalDrawer::fClusters
private

Definition at line 94 of file ecalDrawer.h.

◆ fCX

Int_t ecalDrawer::fCX
private

Definition at line 55 of file ecalDrawer.h.

◆ fCY

Int_t ecalDrawer::fCY
private

Definition at line 56 of file ecalDrawer.h.

◆ fE

Double_t ecalDrawer::fE
private

Definition at line 107 of file ecalDrawer.h.

◆ fEdging

TString ecalDrawer::fEdging
private

Definition at line 63 of file ecalDrawer.h.

◆ fEventN

Int_t ecalDrawer::fEventN
private

Event number

Definition at line 97 of file ecalDrawer.h.

◆ fInf

ecalInf* ecalDrawer::fInf
private

Definition at line 62 of file ecalDrawer.h.

◆ fInName

TString ecalDrawer::fInName
private

Definition at line 95 of file ecalDrawer.h.

◆ fMaxEnergyDep

Double_t ecalDrawer::fMaxEnergyDep
private

Normalization

Definition at line 59 of file ecalDrawer.h.

◆ fMCE

Double_t ecalDrawer::fMCE
private

Definition at line 108 of file ecalDrawer.h.

◆ fMCMotherTrN

Int_t ecalDrawer::fMCMotherTrN
private

Definition at line 105 of file ecalDrawer.h.

◆ fMCPX

Double_t ecalDrawer::fMCPX
private

Definition at line 112 of file ecalDrawer.h.

◆ fMCPY

Double_t ecalDrawer::fMCPY
private

Definition at line 113 of file ecalDrawer.h.

◆ fMCPZ

Double_t ecalDrawer::fMCPZ
private

Definition at line 114 of file ecalDrawer.h.

◆ fMCTracks

TClonesArray* ecalDrawer::fMCTracks
private

Definition at line 92 of file ecalDrawer.h.

◆ fMCX

Double_t ecalDrawer::fMCX
private

Definition at line 102 of file ecalDrawer.h.

◆ fMCY

Double_t ecalDrawer::fMCY
private

Definition at line 103 of file ecalDrawer.h.

◆ fMCZ

Double_t ecalDrawer::fMCZ
private

Definition at line 104 of file ecalDrawer.h.

◆ fNamePrefix

TString ecalDrawer::fNamePrefix
private

Definition at line 51 of file ecalDrawer.h.

◆ fPdgCode

Int_t ecalDrawer::fPdgCode
private

Pdg code. Gamma and neutron(antineutron) only

Definition at line 117 of file ecalDrawer.h.

◆ fPoints

TClonesArray* ecalDrawer::fPoints
private

Definition at line 93 of file ecalDrawer.h.

◆ fPX

Double_t ecalDrawer::fPX
private

Definition at line 109 of file ecalDrawer.h.

◆ fPY

Double_t ecalDrawer::fPY
private

Definition at line 110 of file ecalDrawer.h.

◆ fPZ

Double_t ecalDrawer::fPZ
private

Definition at line 111 of file ecalDrawer.h.

◆ fR

Double_t ecalDrawer::fR
private

Distance between this and closest other hit in the calorimeter

Definition at line 119 of file ecalDrawer.h.

◆ fStr

ecalStructure* ecalDrawer::fStr
private

Structure and info for drawing

Definition at line 61 of file ecalDrawer.h.

◆ fTxt

TText* ecalDrawer::fTxt
private

Definition at line 83 of file ecalDrawer.h.

◆ fX

Double_t ecalDrawer::fX
private

Definition at line 99 of file ecalDrawer.h.

◆ fY

Double_t ecalDrawer::fY
private

Definition at line 100 of file ecalDrawer.h.

◆ fZ

Double_t ecalDrawer::fZ
private

Definition at line 101 of file ecalDrawer.h.


The documentation for this class was generated from the following files: