geom_default.C: Demonstrates usage of "Default" geometry alias. | Event Display | lineset_test.C: Demonstrates usage of class TEveStraightLineSet. |
// Demonstrates usage of TEveJetCone class. // Author: Jochen Thaeder const char* esd_geom_file_name = "http://root.cern.ch/files/alice_ESDgeometry.root"; void jetcone_test() { TEveManager::Create(); using namespace TMath; TRandom r(0); // -- Set Constants Int_t nCones = 10; Int_t nTracks = 200; Float_t coneRadius = 0.4; Float_t length = 300.; // -- Define palette gStyle->SetPalette(1, 0); TEveRGBAPalette* pal = new TEveRGBAPalette(0, 500); // ----------------------------------------------------------------------------------- // -- Line sets // ----------------------------------------------------------------------------------- // -- Define cone center TEveStraightLineSet* axis = new TEveStraightLineSet("Cone Axis"); axis->SetLineColor(kGreen); axis->SetLineWidth(2); TEveStraightLineSet* tracksXYZ = new TEveStraightLineSet("StraightLinesXYZ"); tracksXYZ->SetLineColor(kRed); tracksXYZ->SetLineWidth(2); TEveStraightLineSet* tracksEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhi"); tracksEtaPhi->SetLineColor(kYellow); tracksEtaPhi->SetLineWidth(2); TEveStraightLineSet* tracksSeedEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhiSeed"); tracksSeedEtaPhi->SetLineColor(kBlue); tracksSeedEtaPhi->SetLineWidth(2); // ----------------------------------------------------------------------------------- // -- Draw track distribution in XYZ ( in TPC Volume ) ( +/-250, +/-250, +/-250 ) // ----------------------------------------------------------------------------------- for ( Int_t track=0; track < nTracks ; track++ ) { Float_t trackX = r.Uniform(-250.0, 250.0); Float_t trackY = r.Uniform(-250.0, 250.0); Float_t trackZ = r.Uniform(-250.0, 250.0); Float_t trackR = (Float_t) Sqrt ( trackX*trackX + trackY*trackY + trackZ*trackZ ); /* Float_t trackEta = 0.5 * (Float_t) Log( (Double_t)(( trackR+trackZ )/( trackR-trackZ )) ); Float_t trackPhi = (Float_t) ATan2( (Double_t) trackY, (Double_t) trackX ); if ( trackPhi < 0. ) trackPhi += (Float_t) TwoPi(); */ TEveVector trackDir(trackX/trackR, trackY/trackR ,trackZ/trackR); TEveVector trackEnd = trackDir * length; tracksXYZ->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ ); } // ----------------------------------------------------------------------------------- // -- Draw track distribution in eta phi ( in TPC Volume ) ( +/-0.9, {0, 2Pi} ) // ----------------------------------------------------------------------------------- for ( Int_t track=0; track < nTracks ; track++ ) { Float_t trackEta = r.Uniform(-0.9, 0.9); Float_t trackPhi = r.Uniform(0.0, TwoPi()); TEveVector trackDir( GetTEveVector(trackEta, trackPhi) ); TEveVector trackEnd = trackDir * length; if ( trackEta > coneRadius || trackEta < -coneRadius ) tracksEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ ); else tracksSeedEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ ); } // ----------------------------------------------------------------------------------- // -- Draw cones // ----------------------------------------------------------------------------------- for ( Int_t iter = 0; iter < nCones; ++iter ) { // -- Get Random ( eta ,phi ) Float_t coneEta = r.Uniform(-0.9, 0.9); Float_t conePhi = r.Uniform(0.0, TwoPi() ); // -- Primary vertx as origin TEveVector coneOrigin(0.0,0.0,0.0); // -- Get Cone Axis - axis line 10% longer than cone height TEveVector coneAxis ( GetTEveVector( coneEta, conePhi) ); coneAxis *= length * 1.1; axis->AddLine( 0., 0., 0., coneAxis.fX, coneAxis.fY, coneAxis.fZ ); // -- Draw jet cone TEveJetCone* jetCone = new TEveJetCone("JetCone"); jetCone->SetCylinder( 250., 250. ); if ( (jetCone->AddCone( coneEta, conePhi, coneRadius ) ) != -1) gEve->AddElement( jetCone ); } // ----------------------------------------------------------------------------------- // -- Add cone axis gEve->AddElement(axis); // -- Add lines // gEve->AddElement(tracksXYZ); gEve->AddElement(tracksSeedEtaPhi); gEve->AddElement(tracksEtaPhi); // -- Load TPC geometry geomGentleTPC(); gEve->Redraw3D(kTRUE); return; } // ################################################################################ // ################################################################################ // ################################################################################ TEveVector GetTEveVector( Float_t& eta, Float_t& phi ) { TEveVector vec( (Float_t) Cos ( (Double_t) phi)/ CosH( (Double_t) eta ), (Float_t) Sin ( (Double_t) phi)/ CosH( (Double_t) eta ), (Float_t) TanH( (Double_t) eta ) ); return vec; } // ################################################################################ void geomGentleTPC() { // Simple geometry TFile* geom = TFile::Open(esd_geom_file_name, "CACHEREAD"); if (!geom) return; TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) geom->Get("Gentle"); TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0); geom->Close(); delete geom; gEve->AddGlobalElement(gsre); TEveElement* elTRD = gsre->FindChild("TRD+TOF"); elTRD->SetRnrState(kFALSE); TEveElement* elPHOS = gsre->FindChild("PHOS"); elPHOS->SetRnrState(kFALSE); TEveElement* elHMPID = gsre->FindChild("HMPID"); elHMPID->SetRnrState(kFALSE); } jetcone_test.C:1 jetcone_test.C:2 jetcone_test.C:3 jetcone_test.C:4 jetcone_test.C:5 jetcone_test.C:6 jetcone_test.C:7 jetcone_test.C:8 jetcone_test.C:9 jetcone_test.C:10 jetcone_test.C:11 jetcone_test.C:12 jetcone_test.C:13 jetcone_test.C:14 jetcone_test.C:15 jetcone_test.C:16 jetcone_test.C:17 jetcone_test.C:18 jetcone_test.C:19 jetcone_test.C:20 jetcone_test.C:21 jetcone_test.C:22 jetcone_test.C:23 jetcone_test.C:24 jetcone_test.C:25 jetcone_test.C:26 jetcone_test.C:27 jetcone_test.C:28 jetcone_test.C:29 jetcone_test.C:30 jetcone_test.C:31 jetcone_test.C:32 jetcone_test.C:33 jetcone_test.C:34 jetcone_test.C:35 jetcone_test.C:36 jetcone_test.C:37 jetcone_test.C:38 jetcone_test.C:39 jetcone_test.C:40 jetcone_test.C:41 jetcone_test.C:42 jetcone_test.C:43 jetcone_test.C:44 jetcone_test.C:45 jetcone_test.C:46 jetcone_test.C:47 jetcone_test.C:48 jetcone_test.C:49 jetcone_test.C:50 jetcone_test.C:51 jetcone_test.C:52 jetcone_test.C:53 jetcone_test.C:54 jetcone_test.C:55 jetcone_test.C:56 jetcone_test.C:57 jetcone_test.C:58 jetcone_test.C:59 jetcone_test.C:60 jetcone_test.C:61 jetcone_test.C:62 jetcone_test.C:63 jetcone_test.C:64 jetcone_test.C:65 jetcone_test.C:66 jetcone_test.C:67 jetcone_test.C:68 jetcone_test.C:69 jetcone_test.C:70 jetcone_test.C:71 jetcone_test.C:72 jetcone_test.C:73 jetcone_test.C:74 jetcone_test.C:75 jetcone_test.C:76 jetcone_test.C:77 jetcone_test.C:78 jetcone_test.C:79 jetcone_test.C:80 jetcone_test.C:81 jetcone_test.C:82 jetcone_test.C:83 jetcone_test.C:84 jetcone_test.C:85 jetcone_test.C:86 jetcone_test.C:87 jetcone_test.C:88 jetcone_test.C:89 jetcone_test.C:90 jetcone_test.C:91 jetcone_test.C:92 jetcone_test.C:93 jetcone_test.C:94 jetcone_test.C:95 jetcone_test.C:96 jetcone_test.C:97 jetcone_test.C:98 jetcone_test.C:99 jetcone_test.C:100 jetcone_test.C:101 jetcone_test.C:102 jetcone_test.C:103 jetcone_test.C:104 jetcone_test.C:105 jetcone_test.C:106 jetcone_test.C:107 jetcone_test.C:108 jetcone_test.C:109 jetcone_test.C:110 jetcone_test.C:111 jetcone_test.C:112 jetcone_test.C:113 jetcone_test.C:114 jetcone_test.C:115 jetcone_test.C:116 jetcone_test.C:117 jetcone_test.C:118 jetcone_test.C:119 jetcone_test.C:120 jetcone_test.C:121 jetcone_test.C:122 jetcone_test.C:123 jetcone_test.C:124 jetcone_test.C:125 jetcone_test.C:126 jetcone_test.C:127 jetcone_test.C:128 jetcone_test.C:129 jetcone_test.C:130 jetcone_test.C:131 jetcone_test.C:132 jetcone_test.C:133 jetcone_test.C:134 jetcone_test.C:135 jetcone_test.C:136 jetcone_test.C:137 jetcone_test.C:138 jetcone_test.C:139 jetcone_test.C:140 jetcone_test.C:141 jetcone_test.C:142 jetcone_test.C:143 jetcone_test.C:144 jetcone_test.C:145 jetcone_test.C:146 jetcone_test.C:147 jetcone_test.C:148 jetcone_test.C:149 jetcone_test.C:150 jetcone_test.C:151 jetcone_test.C:152 jetcone_test.C:153 jetcone_test.C:154 jetcone_test.C:155 jetcone_test.C:156 jetcone_test.C:157 jetcone_test.C:158 jetcone_test.C:159 jetcone_test.C:160 jetcone_test.C:161 jetcone_test.C:162 jetcone_test.C:163 jetcone_test.C:164 jetcone_test.C:165 jetcone_test.C:166 |
|