FEDRA emulsion software from the OPERA Collaboration
EdbEDAExtentionSet Class Reference

#include <EdbEDASets.h>

Inheritance diagram for EdbEDAExtentionSet:
Collaboration diagram for EdbEDAExtentionSet:

Public Member Functions

void Disable ()
 
void Draw (int redraw=0, int fix=0)
 
void DrawResolution (int redraw=0)
 
 EdbEDAExtentionSet ()
 
void Enable ()
 
double GetZ ()
 
void SetZ (double z)
 
void UnDraw (int redraw=0)
 

Private Attributes

int eColor
 
TEveCompound * eCompound
 
int eEnable
 
double eZ
 

Constructor & Destructor Documentation

◆ EdbEDAExtentionSet()

EdbEDAExtentionSet::EdbEDAExtentionSet ( )
inline
238 :eEnable(0),eColor(kGray),eZ(0.0),eCompound(NULL){};
int eColor
Definition: EdbEDASets.h:233
TEveCompound * eCompound
Definition: EdbEDASets.h:235
int eEnable
Definition: EdbEDASets.h:232
double eZ
Definition: EdbEDASets.h:234
#define NULL
Definition: nidaqmx.h:84

Member Function Documentation

◆ Disable()

void EdbEDAExtentionSet::Disable ( )
inline
244 { eEnable=0;}

◆ Draw()

void EdbEDAExtentionSet::Draw ( int  redraw = 0,
int  fix = 0 
)
225  {
226  if(!eEnable) return;
227  if(eCompound) UnDraw();
228 
229  TObjArray *selected = gEDA->GetSelected();
230  if(selected->GetEntriesFast()==0) return;
231  eCompound = new TEveCompound;
232  eCompound->SetName("ExtentionSet");
233  gEve->AddElement(eCompound);
234 
235  for(int i=0;i<selected->GetEntriesFast();i++){
236  EdbSegP *s = (EdbSegP *) selected->At(i);
237  EdbTrackP *t = gEDA->GetTrack(s);
238  TEveLine *l = new TEveLine;
239  l->SetName(Form("seg itrk %4d flag %4d pl %2d id %6d ph %2d %8.1lf %8.1lf %8.1lf %7.4lf %7.4lf %4d",
240  t?t->ID():0, t?t->Flag():0, s->Plate(), (int)s->ID(), (int)s->W(),
241  s->X(), s->Y(), s->Z(), s->TX(), s->TY(), s->Flag()));
242  l->SetLineColor(eColor);
243  l->SetNextPoint(s->X(), s->Y(), s->Z()*gEDA->GetScaleZ());
244  l->SetNextPoint(s->X()+s->TX()*(eZ-s->Z()),
245  s->Y()+s->TY()*(eZ-s->Z()),
246  (eZ)*gEDA->GetScaleZ());
247  //l->SetUserData(s);
248  if(fix) gEve->AddElement(l);
249  else eCompound->AddElement(l);
250  }
251 
252  if(redraw) gEve->Redraw3D();
253 }
EdbEDA * gEDA
Definition: EdbEDA.C:3
TTree * t
Definition: check_shower.C:4
void UnDraw(int redraw=0)
Definition: EdbEDASets.C:255
TObjArray * GetSelected(void)
Definition: EdbEDA.h:405
double GetScaleZ()
Definition: EdbEDA.h:732
EdbTrackP * GetTrack(EdbSegP *s)
Definition: EdbEDA.h:598
Definition: EdbSegP.h:18
Float_t TX() const
Definition: EdbSegP.h:172
Int_t ID() const
Definition: EdbSegP.h:144
Float_t X() const
Definition: EdbSegP.h:170
Int_t Plate() const
Definition: EdbSegP.h:156
Float_t Z() const
Definition: EdbSegP.h:150
Float_t Y() const
Definition: EdbSegP.h:171
Float_t W() const
Definition: EdbSegP.h:148
Float_t TY() const
Definition: EdbSegP.h:173
Int_t Flag() const
Definition: EdbSegP.h:146
Definition: EdbPattern.h:118
EdbSegP * s
Definition: tlg2pattern.C:32

◆ DrawResolution()

void EdbEDAExtentionSet::DrawResolution ( int  redraw = 0)
265  {
266  TObjArray *selected = gEDA->GetSelected();
267  TObjArray *selected_tracks = gEDA->GetSelectedTracks();
268 
269  for(int i=0;i<selected->GetEntriesFast();i++){
270  EdbSegP *s = (EdbSegP *) selected->At(i);
271  EdbTrackP *t = (EdbTrackP*) selected_tracks->At(i); // temporary
272 
273  double p,pmin,pmax;
274  if(t!=NULL){
275  p=t->P();
276  if(p<0) CalcP(t, p, pmin, pmax);
277  if(p<0.01) p = 1.0;
278  } else p = 1.0;
279 
280 
281  // definition of cone set.
282  TEveBoxSet* cones = new TEveBoxSet("ConeSet");
283  cones->Reset(TEveBoxSet::kBT_Cone, kFALSE, 64);
284 
285  // setting for colors. seems necessary.
286  gStyle->SetPalette(-1);
287  TEveRGBAPalette* pal = new TEveRGBAPalette(0, 50);
288  cones->SetPalette(pal);
289 
290  TEveVector dir, pos;
291  int direction = eZ<s->Z() ? -1 : 1; // parity of cone direction.
292 
293  double angle = sqrt(s->TX()*s->TX()+s->TY()*s->TY());
294  double dtheta = 0.002+ 0.002*angle;
295  double dr = 0.5 + angle;
296 
297  double step = 20;
298  for(double dz=10;dz<fabs(eZ-s->Z())+step;dz+=step){ // dz : at the circle.
299  int flag_last=0; // if it is the last cone, put cap on it.
300  if(dz > fabs(eZ-s->Z())) {
301  dz = fabs(eZ-s->Z());
302  flag_last=1;
303  }
304  dir.Set( s->TX(), s->TY(), (Float_t)1.0); // direction of cone.
305  double height = dz<300? dz : 300; // hight of cone.
306  dir *= direction * height;
307 
308  // resolutions. currently calculated as all in lead.
309  double dz2 = direction*fabs(dz-height); // dz2 at the vertex.
310  double l = dz*sqrt(1+angle*angle); // length from segment
311  double dr_theta = dtheta*l; // dr from angle resolution
312  double dr_scatt = 0.0136/p*sqrt(l/3/5700.0)*l; // dr from scatterning
313  double r = sqrt(dr*dr+dr_theta*dr_theta+dr_scatt*dr_scatt); // radius = 1sigma of error
314 
315  pos.Set(s->X()+dz2*s->TX(), s->Y()+dz2*s->TY(), s->Z()+dz2); // position of vertex
316  cones->AddCone(pos, dir, r);
317  cones->DigitValue(18);
318 
319  if(flag_last){ // Cap
320  dir.Set( s->TX(), s->TY(), (Float_t)1.0);
321  dir *= -direction*r;
322  dz2 = direction*fabs(dz+r);
323  pos.Set(s->X()+dz2*s->TX(), s->Y()+dz2*s->TY(), s->Z()+dz2);
324  cones->AddCone(pos, dir, r);
325  cones->DigitValue(18);
326  printf("Extention with resolution, track %4d p = %.2lf, resolution = %.1lf um at z = %.0lf (dz = %.0lf)\n", t->ID(), p, r, s->Z()+direction*dz, dz);
327  }
328  }
329  gEve->AddElement(cones);
330  }
331  printf("draw\n");
332  if(redraw) gEve->Redraw3D();
333 }
brick dz
Definition: RecDispMC.C:107
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
TObjArray * GetSelectedTracks(void)
Definition: EdbEDA.h:417
EdbMomentumEstimator * CalcP(EdbTrackP *t, double &p, double &pmin, double &pmax, bool print=kTRUE)
Definition: EdbEDAUtil.C:369
p
Definition: testBGReduction_AllMethods.C:8
void r(int rid=2)
Definition: test.C:201

◆ Enable()

void EdbEDAExtentionSet::Enable ( )
inline
243 { eEnable=1;}

◆ GetZ()

double EdbEDAExtentionSet::GetZ ( void  )
inline
246 { return eZ;}

◆ SetZ()

void EdbEDAExtentionSet::SetZ ( double  z)
inline
245 { eZ=z;}

◆ UnDraw()

void EdbEDAExtentionSet::UnDraw ( int  redraw = 0)
255  {
256  if(gEve->GetCurrentEvent()!=NULL){
257  TEveElement *ext = gEve->GetCurrentEvent()->FindChild("ExtentionSet");
258  if(ext) ext->Destroy();
259  //if(ext) gEve->GetCurrentEvent()->RemoveElement(ext);
260  }
261  eCompound=NULL;
262  if(redraw) gEve->Redraw3D();
263 }

Member Data Documentation

◆ eColor

int EdbEDAExtentionSet::eColor
private

◆ eCompound

TEveCompound* EdbEDAExtentionSet::eCompound
private

◆ eEnable

int EdbEDAExtentionSet::eEnable
private

◆ eZ

double EdbEDAExtentionSet::eZ
private

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