9 #include <TClonesArray.h>
10 #include <TPolyLine3D.h>
11 #include <TPolyMarker3D.h>
15 #include <TGeoGlobalMagField.h>
18 #include <AliCDBManager.h>
19 #include <AliTPCParam.h>
20 #include <AliGeomManager.h>
21 #include <AliTPCcalibDB.h>
22 #include <AliTrackPointArray.h>
23 #include <AliCluster.h>
25 #include <AliTPCLaserTrack.h>
28 #include "AliToyMCDrawer.h"
29 #include "AliToyMCEvent.h"
30 #include "AliToyMCTrack.h"
32 // Visualization class. To use
34 // AliToyMCDrawer* draw = new AliToyMCDrawer()
35 // draw->SetFileName("path/to/toyMC.root")
37 // draw->FillEventArray(Int_t centerEventNumber)
39 // draw->FillEventArray(Double_t time)
40 // to display with a certain event in the center or at a certain time
42 // draw->DrawEvents(Bool_t both, Bool_t before)
43 // where "both" will display events before and after the middle event and
44 // before will show also events before (after) the middle event if true (false)
45 // when "both" is false
48 ClassImp(AliToyMCDrawer);
50 AliToyMCDrawer::AliToyMCDrawer()
65 ,fRoc(AliTPCROC::Instance())
69 fEventArray = new TClonesArray("AliToyMCEvent");
71 fTPCParam = AliTPCcalibDB::Instance()->GetParameters();
72 fTPCParam->ReadGeoMatrices();
73 fDriftVel = fTPCParam->GetDriftV();
74 fMaxZ0 =fTPCParam->GetZLength();
75 fTimeRange = 2*fMaxZ0/fDriftVel;
77 fPoints = new TClonesArray("TPolyMarker3D");
78 fDistPoints = new TClonesArray("TPolyMarker3D");
80 //________________________________________________________________
81 AliToyMCDrawer::AliToyMCDrawer(const AliToyMCDrawer &drawer)
83 ,fInputTree(drawer.fInputTree)
84 ,fInFile(drawer.fInFile)
85 ,fFileName(drawer.fFileName)
86 ,fEvent(drawer.fEvent)
87 ,fEventArray(drawer.fEventArray)
88 ,fDispHist(drawer.fDispHist)
89 , fCenterTime(drawer.fCenterTime)
90 ,fDriftVel(drawer.fDriftVel)
91 ,fTPCParam(drawer.fTPCParam)
92 ,fMaxZ0(drawer.fMaxZ0)
93 ,fIFCRadius(drawer.fIFCRadius)
94 ,fOFCRadius(drawer.fOFCRadius)
95 ,fTimeRange(drawer.fTimeRange)
97 ,fPoints(drawer.fPoints)
98 ,fDistPoints(drawer.fDistPoints)
102 //_____________________________________________________
103 AliToyMCDrawer& AliToyMCDrawer::operator = (const AliToyMCDrawer &drawer)
105 //assignment operator
106 if (&drawer == this) return *this;
107 new (this) AliToyMCDrawer(drawer);
112 //________________________________________________________________
113 AliToyMCDrawer::~AliToyMCDrawer()
122 //________________________________________________________________
123 Int_t AliToyMCDrawer::FillEventArray(Double_t snapShotTime)
125 if(fFileName.IsNull()) {
126 std::cout << "no input file provided, using default (toyMC.root)" << std::endl;
127 fFileName = "toyMC.root";
130 fInFile = new TFile(fFileName.Data(),"read");
132 fInputTree = dynamic_cast<TTree*> (fInFile->Get("toyMCtree"));
133 fInputTree->SetBranchAddress("event",&fEvent);
134 fEventArray->Clear();
136 Int_t leftSearchIndex = Int_t(snapShotTime/2e-5);
137 if(leftSearchIndex>fInputTree->GetEntries()) {
138 leftSearchIndex = fInputTree->GetEntries()-1;
139 fInputTree->GetEvent(leftSearchIndex);
140 snapShotTime = fEvent->GetT0();
141 std::cout << "input time too large, setting time to time of last event" << std::endl;
143 if(leftSearchIndex<0) leftSearchIndex = 0;
145 //fCenterTime = snapShotTime;
147 fInputTree->GetEvent(leftSearchIndex);
148 Double_t leftTime = fEvent ->GetT0();
149 Int_t firstEventIndex;
150 //if fEvent exactly at snapShotTime, check if there are more events at the same time but with lower indices
151 if( TMath::Abs(leftTime - snapShotTime)<5e-9)
153 // printf("close from start, lefttime = %2.2f\n",leftTime);
154 firstEventIndex = leftSearchIndex+1;
155 while( TMath::Abs(leftTime- snapShotTime) < 5e-9){
157 // printf("close from start, lefttime = %2.2f\n",leftTime);
158 if(fInputTree->GetEvent(firstEventIndex-1))
160 leftTime=fEvent->GetT0();
161 // printf("close from start, lefttime = %2.2f\n",leftTime);
170 Int_t rightSearchIndex = leftSearchIndex;
173 Int_t direction = 1; //go right
174 if(leftTime > snapShotTime) {
177 rightSearchIndex+= direction;
178 if(!fInputTree->GetEvent(rightSearchIndex)) return FillEventArray(leftSearchIndex);
179 rightTime = fEvent->GetT0();
180 // std::cout << "bef search " << leftTime << " " << rightTime<< " " << " " << snapShotTime << " "<< (leftTime-snapShotTime)*(rightTime-snapShotTime) << std::endl;
183 while ( (leftTime-snapShotTime)*(rightTime-snapShotTime)>0 ){
184 // printf("searching, leftime %f, righttim %f\n",leftTime,rightTime);
185 rightSearchIndex += direction;
186 leftSearchIndex +=direction;
187 fInputTree->GetEvent(leftSearchIndex);
188 leftTime = fEvent->GetT0();
189 if(!fInputTree->GetEvent(rightSearchIndex)) {
190 rightSearchIndex-=direction;
194 rightTime = fEvent->GetT0();
195 printf("searching, leftime %f, righttim %f\n",leftTime,rightTime);
197 if (direction==-1) rightSearchIndex = leftSearchIndex;
198 firstEventIndex = rightSearchIndex;
201 // fInputTree->GetEvent(firstEventIndex);
202 //std::cout <<"first event after sn time: " << fEvent->GetT0() << std::endl;
203 return FillEventArray(firstEventIndex, snapShotTime);
206 //________________________________________________________________
207 Int_t AliToyMCDrawer::FillEventArray(Int_t middleEventNbr, Double_t snapShotTime)
209 if(fFileName.IsNull()) {
210 std::cout << "no input file provided, using default (toyMC.root)" << std::endl;
211 fFileName = "toyMC.root";
213 if(!fInFile) fInFile = new TFile(fFileName.Data(),"read");
217 fInputTree = dynamic_cast<TTree*> (fInFile->Get("toyMCtree"));
218 // fInputTree->Add(fileName);
219 fInputTree->SetBranchAddress("event",&fEvent);
221 Double_t centerEventTime;
222 if(fInputTree->GetEvent(middleEventNbr))
224 centerEventTime = fEvent->GetT0();
229 if(snapShotTime<0) fCenterTime = centerEventTime;
230 else fCenterTime = snapShotTime;
232 fEventArray->Clear();
233 if(fInputTree->GetEvent(middleEventNbr)){
234 new((*fEventArray)[fEventArray->GetEntriesFast()]) AliToyMCEvent(*fEvent);
236 //add events after middle event
237 Int_t eventIndex = middleEventNbr + 1;
238 Double_t currentTime = centerEventTime;
239 if(fInputTree->GetEvent(eventIndex)) {
240 currentTime = fEvent->GetT0();
241 while(currentTime - centerEventTime < fTimeRange/2) {
242 new((*fEventArray)[fEventArray->GetEntriesFast()]) AliToyMCEvent(*fEvent);
244 if(!fInputTree->GetEvent(eventIndex)) break;
245 currentTime = fEvent->GetT0();
248 //add events before middle event
249 eventIndex = middleEventNbr - 1;
250 if(fInputTree->GetEvent(eventIndex)){
251 currentTime = fEvent->GetT0();
252 while(centerEventTime-currentTime < fTimeRange/2) {
254 new((*fEventArray)[fEventArray->GetEntriesFast()]) AliToyMCEvent(*fEvent);
256 if(!fInputTree->GetEvent(eventIndex)) break;
257 currentTime = fEvent->GetT0();
261 std::cout << " end fill" << std::endl;
266 printf("Selected event number (%d) out of range!\n",middleEventNbr);
271 //________________________________________________________________
272 void AliToyMCDrawer::DrawEvents(Bool_t both, Bool_t before)
276 fDistPoints->Clear();
280 Double_t phiCut = 1.;
281 TLegend *leg = new TLegend(0.1,0.75,0.6,1,Form("Snapshot of TPC at %f micros after sim start, freq. = , bunchcr.rate = .",1000000*fCenterTime));
282 leg->AddEntry((TObject*)0,Form("%2.2f<#phi<#pi-%2.2f && #pi+%2.2f<#phi<2#pi-%2.2f",phiCut,phiCut,phiCut,phiCut),"");
287 for(Int_t iEvent = 0; iEvent<fEventArray->GetEntriesFast(); iEvent++){
290 AliToyMCEvent *currentEvent = static_cast<AliToyMCEvent*> (fEventArray->At(iEvent));
291 Double_t currentEventTime = currentEvent->GetT0();
293 if((1000000*currentEventTime)>((1000000*fCenterTime)+0.05 )) {
294 printf("larger iEvent: %d, current %f, center %f, ntracks: %d\n",iEvent, currentEventTime,fCenterTime, currentEvent->GetNumberOfTracks());
296 if ( !(both || !before)) continue;
299 if( currentEventTime<=fCenterTime)// && !(currentEventTime==fCenterTime &&both ))
301 printf("smaller iEvent: %d, current %f, center %f, ntracks: %d\n",iEvent, currentEventTime,fCenterTime, currentEvent->GetNumberOfTracks());
303 if ( !(both || before)) continue;
306 //std:: cout << "iev " << iEvent << " " << color << std::endl;
307 Double_t currentEventTimeRelToCentral = fCenterTime - currentEventTime;
309 Int_t color = ((currentEvent->GetEventNumber())%10);
310 if(color == 0||color ==1) {
311 color==0?color=2:color=3;
312 // if(iEvent==0) color = 8;
313 // if(iEvent==1) color = 9;
317 char bef[] = "before snapshot time";
318 char aft[] = "after snapshot time";
321 if( 1000000*(currentEventTime-fCenterTime) > 0.5) {when = aft;
325 TGraph *temp = new TGraph();
326 temp->SetName(Form("temp%d",currentEvent->GetEventNumber()));
327 temp->SetLineColor(color);
328 temp->SetLineWidth(10);
330 leg->AddEntry(temp,Form(" %2.2f microseconds %s (global time %2.2f) at z_vertex = %2.2f, centr = ., eventNr: %d", 1000000*sign*currentEventTimeRelToCentral, when, 1000000*currentEvent->GetT0(), currentEvent->GetZ() ,currentEvent->GetEventNumber() ),"l");
333 DrawEvent(currentEvent, fCenterTime, color);
343 //________________________________________________________________
345 void AliToyMCDrawer::DrawEvent(AliToyMCEvent *currentEvent, Double_t centerTime, Int_t color){
346 if(!fDispHist) DrawGeometry();
348 for(Int_t iTrack = 0; iTrack < currentEvent->GetNumberOfTracks(); iTrack++){
350 //Double_t alpha = TMath::ATan2(currentEvent->GetTrack(iTrack)->GetSpacePoint(0)->GetY(),currentEvent->GetTrack(iTrack)->GetSpacePoint(0)->GetX());
351 // if( ( ( !(abs(alpha)>phiCut && abs(alpha) < TMath::Pi() - phiCut) ) ) )continue;
357 //if(currentEvent->GetTrack(iTrack)->GetSpacePoint(0)->GetY()<0) alpha +=TMath::Pi();
358 //if( ( (alpha>phiCut && alpha < TMath::Pi() - phiCut) || ( alpha>TMath::Pi() + phiCut && alpha < TMath::TwoPi() - phiCut)) )continue;
360 // if(alpha > 0) continue;
362 //std::cout << TMath::ASin(tempTrack->GetParameter()[2]) << std::endl;
363 // Double_t x = currentEvent->GetX();
364 // Double_t y = currentEvent->GetY();
365 // Double_t hlxpar[6];
366 // currentEvent->GetTrack(iTrack)->GetHelixParameters(hlxpar,0);
367 // Double_t trackPhi = hlxpar[2];
368 // Double_t phiCut = 1.47;
369 // std::cout << "bef phi cut "<< trackPhi<< std::endl;
371 // std::cout << "aft phi cut " << std::endl;
372 // Double_t trackEta = currentEvent->GetTrack(iTrack)->GetEta();
373 // Double_t z = currentEvent->GetZ();
379 const AliToyMCTrack *tempTrack = currentEvent->GetTrack(iTrack);
380 //AliToyMCTrack *tempTrack = new AliToyMCTrack(*currentEvent->GetTrack(iTrack));
381 DrawTrack(tempTrack, centerTime, currentEvent->GetT0(),color);
399 //________________________________________________________________
400 void AliToyMCDrawer::DrawLaserEvent(Int_t nLaserEvents, Int_t side, Int_t rod, Int_t bundle, Int_t beam)
407 fDistPoints->Clear();
408 if (!ConnectInputTree()) return;
410 AliTPCLaserTrack::LoadTracks();
411 TObjArray *arr=AliTPCLaserTrack::GetTracks();
416 for (Int_t iev=0;iev<fInputTree->GetEntries();++iev) {
417 fInputTree->GetEntry(iev);
418 if (fEvent->GetEventType()!=AliToyMCEvent::kLaser) continue;
419 if (fEvent->GetNumberOfTracks()!=arr->GetEntriesFast()) {
420 AliError(Form("Wrong number of tracks in the laser event: %d!=%d",fEvent->GetNumberOfTracks(),arr->GetEntriesFast()));
424 for (Int_t iTrack=0; iTrack<fEvent->GetNumberOfTracks();++iTrack){
425 AliTPCLaserTrack *laserTrack = (AliTPCLaserTrack*)arr->UncheckedAt(iTrack);
426 if (side >-1 && laserTrack->GetSide() != side ) continue;
427 if (rod >-1 && laserTrack->GetRod() != rod ) continue;
428 if (bundle>-1 && laserTrack->GetBundle() != bundle ) continue;
429 if (beam >-1 && laserTrack->GetBeam() != beam ) continue;
430 const AliToyMCTrack *track = fEvent->GetTrack(iTrack);
431 DrawTrack(track,0,fEvent->GetT0(),kRed);
435 if (laserEvents==nLaserEvents) break;
441 //________________________________________________________________
442 void AliToyMCDrawer::DrawTrack(const AliToyMCTrack *track, Double_t centerTime, Double_t currentEventTime, Int_t color){
443 if(!fDispHist) DrawGeometry();
445 TPolyMarker3D *disttrackpoints = new((*fDistPoints)[fDistPoints->GetEntriesFast()]) TPolyMarker3D();
446 TPolyMarker3D *trackpoints = new((*fPoints)[fPoints->GetEntriesFast()]) TPolyMarker3D();
448 Double_t currentEventTimeRelToCentral = centerTime - currentEventTime;
449 Int_t nDistPoints = track->GetNumberOfDistSpacePoints();
450 Int_t nPoints = track->GetNumberOfSpacePoints();
452 for(Int_t iITSPoint = 0; iITSPoint< track->GetNumberOfITSPoints();iITSPoint++){
454 Double_t xp = track->GetITSPoint(iITSPoint)->GetX();
455 Double_t yp = track->GetITSPoint(iITSPoint)->GetY();
456 Double_t zp = track->GetITSPoint(iITSPoint)->GetZ();
457 Double_t zDrifted = zp+(zp/TMath::Abs(zp))*currentEventTimeRelToCentral * fDriftVel;
458 trackpoints->SetNextPoint(zDrifted,xp,yp);
461 for(Int_t iPoint = 0; iPoint< (nDistPoints<nPoints?nPoints:nDistPoints);iPoint++){
465 Double_t xp = track->GetSpacePoint(iPoint)->GetX();
466 Double_t yp = track->GetSpacePoint(iPoint)->GetY();
467 Double_t zp = track->GetSpacePoint(iPoint)->GetZ();
468 Double_t zDrifted = zp+(zp/TMath::Abs(zp))*currentEventTimeRelToCentral * fDriftVel;
469 //Double_t zDrifted = (zp/TMath::Abs(zp))*fMaxZ0 -(zp/TMath::Abs(zp))* fDriftVel*(track->GetSpacePoint(iPoint)->GetTimeBin() -centerTime );
470 Float_t xyzp[3] = {xp,yp,zp};
473 Float_t tempcov[6] = {0};
475 Int_t sec = track->GetSpacePoint(iPoint)->GetDetector();
476 Double_t angle=((sec%18)*20.+10.)/TMath::RadToDeg();
477 AliTrackPoint prot = p.Rotate(-angle);
483 if(track->GetSpacePoint(iPoint)->GetRow()!=255) {
484 if(TMath::Abs(zDrifted)<fMaxZ0 && zDrifted*zp >=0 /*&&TMath::Sqrt(xp*xp + yp*yp)<fIFCRadius*/) trackpoints->SetNextPoint(zDrifted,xp,yp);
487 else std::cout << "row == " << track->GetSpacePoint(iPoint)->GetRow() << std::endl;
490 if(iPoint<nDistPoints) {
491 Double_t xpdist = track->GetDistortedSpacePoint(iPoint)->GetX();
492 Double_t ypdist = track->GetDistortedSpacePoint(iPoint)->GetY();
493 Double_t zpdist = track->GetDistortedSpacePoint(iPoint)->GetZ();
494 //std::cout << zpdist << std::endl;
496 Float_t xyzpdist[3] = {xpdist,ypdist,zpdist};
498 pdist.SetXYZ(xyzpdist);
499 Float_t tempcovdist[6] = {0};
500 pdist.SetCov(tempcovdist);
501 Int_t secdist = track->GetDistortedSpacePoint(iPoint)->GetDetector();
502 Double_t angledist=((secdist%18)*20.+10.)/TMath::RadToDeg();
503 AliTrackPoint protdist = pdist.Rotate(-angledist);
504 xpdist = protdist.GetX();
505 ypdist = protdist.GetY();
508 UInt_t sector = track->GetDistortedSpacePoint(iPoint)->GetDetector();
509 UInt_t row = track->GetDistortedSpacePoint(iPoint)->GetRow();
510 UInt_t pad = track->GetDistortedSpacePoint(iPoint)->GetPad();
512 Int_t nPads = fTPCParam->GetNPads(sector,row);
513 Int_t intPad = TMath::Nint(Float_t(pad+nPads/2));
516 //std::cout <<"sector: " << sector << " row: " << row << " pad: " <<pad<< std::endl;
517 fRoc->GetPositionGlobal(sector,row,intPad,xyz);
519 Double_t zDrifteddist = (zpdist/TMath::Abs(zpdist))*fMaxZ0 -(zpdist/TMath::Abs(zpdist))* fDriftVel*(track->GetDistortedSpacePoint(iPoint)->GetTimeBin() -centerTime );
522 if(TMath::Abs(zDrifteddist)<fMaxZ0 && zDrifteddist*zpdist>=0 /*&&TMath::Sqrt(xpdist*xpdist + ypdist*ypdist)<fIFCRadius*/) {
524 disttrackpoints->SetNextPoint(zDrifteddist,xpdist,ypdist);
525 //if(TMath::Sqrt(xpdist*xpdist + ypdist*ypdist)<fIFCRadius) std::cout << "fMaxZ0 " << fMaxZ0 <<" inside " << xpdist << " " << "zpdist " << zpdist << " " << "zDrifteddist "<< zDrifteddist << " " << zDrifteddist*zpdist << std::endl;
528 else std::cout << "row == " << row << std::endl;
529 //Double_t zDrifteddist =(zpdist/TMath::Abs(zpdist))*fMaxZ0 -(zpdist/TMath::Abs(zpdist))*(currentEvent->GetTrack(iTrack)->GetDistortedSpacePoint(iPoint)->GetTimeBin()- currentEvent->GetT0() )* fDriftVel;
533 // if( ( (trackPhi>phiCut && trackPhi < TMath::Pi() - phiCut) || ( trackPhi>TMath::Pi() + phiCut && trackPhi < TMath::TwoPi() - phiCut)) ) {
541 for(Int_t iTRDPoint = 0; iTRDPoint< track->GetNumberOfTRDPoints();iTRDPoint++){
543 Double_t xp = track->GetTRDPoint(iTRDPoint)->GetX();
544 Double_t yp = track->GetTRDPoint(iTRDPoint)->GetY();
545 Double_t zp = track->GetTRDPoint(iTRDPoint)->GetZ();
546 Double_t zDrifted = zp+(zp/TMath::Abs(zp))*currentEventTimeRelToCentral * fDriftVel;
547 trackpoints->SetNextPoint(zDrifted,xp,yp);
551 if(trackpoints && trackpoints->GetN()>0) {
552 // trackpoints->SetMarkerColor(1+currentEvent->GetEventNumber()%9);
553 //trackpoints->SetMarkerStyle(6);
554 trackpoints->Draw("same");
556 if(disttrackpoints && disttrackpoints->GetN()>0) {
558 //disttrackpoints->SetMarkerStyle(6);
559 disttrackpoints->SetMarkerColor(color);
562 disttrackpoints->Draw("same");
573 //________________________________________________________________
574 void AliToyMCDrawer::DrawGeometry() {
578 //fDispGraph = new TGraph2D();
581 fDispHist = new TH3F("fDispHist","",100,-fMaxZ0, fMaxZ0, 100,-(fOFCRadius +10), fOFCRadius +10,100,-(fOFCRadius +10), fOFCRadius +10);
582 //if(!fDispGraph) fDispGraph = new TGraph();
584 //fDispGraph->Clear();
585 fDispHist->SetStats(0);
586 fDispHist->GetXaxis()->SetTitle("z [cm]");
587 fDispHist->GetYaxis()->SetTitle("x [cm]");
588 fDispHist->GetZaxis()->SetTitle("y [cm]");
592 TPolyLine3D *endCap1 = new TPolyLine3D();
593 TPolyLine3D *endCap2 = new TPolyLine3D();
594 TPolyLine3D *cage[16] ={0x0};
595 TPolyLine3D *innerCage[16] ={0x0};
596 TPolyLine3D *innerEndCap1 = new TPolyLine3D();
597 TPolyLine3D *innerEndCap2 = new TPolyLine3D();
598 for(Int_t i = 0; i<16; i++){
600 cage[i] = new TPolyLine3D();
601 cage[i]->SetPoint(0,-fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
602 cage[i]->SetPoint(1,fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
603 innerCage[i] = new TPolyLine3D();
604 innerCage[i]->SetPoint(0,-fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
605 innerCage[i]->SetPoint(1,fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
607 endCap1->SetPoint(i,fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
608 endCap2->SetPoint(i,-fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
610 innerEndCap1->SetPoint(i,fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
611 innerEndCap2->SetPoint(i,-fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
612 innerCage[i]->Draw("same");
613 if(!(i%2)) cage[i]->Draw("same");
616 endCap1->SetPoint(16,fMaxZ0,fOFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
617 endCap2->SetPoint(16,-fMaxZ0,fOFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
619 innerEndCap1->SetPoint(16,fMaxZ0,fIFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
620 innerEndCap2->SetPoint(16,-fMaxZ0,fIFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
623 //fDispGraph->SetTitle("ToyMC display");
625 endCap1->Draw("same");
626 endCap2->Draw("same");
628 innerEndCap2->Draw("same");
629 innerEndCap1->Draw("same");
636 //________________________________________________________________
637 Bool_t AliToyMCDrawer::ConnectInputTree()
643 if(fFileName.IsNull()) {
644 AliError("no input file provided, using default (toyMC.root)");
645 fFileName = "toyMC.root";
647 if (fInFile && fInFile->GetName()==fFileName) return kTRUE;
653 fInFile = new TFile(fFileName.Data(),"read");
654 if (!fInFile || !fInFile->IsOpen() || fInFile->IsZombie() ) {
661 fInputTree = dynamic_cast<TTree*> (fInFile->Get("toyMCtree"));
664 AliError("Could not connect tree!\n");
670 fInputTree->SetBranchAddress("event",&fEvent);