File indexing completed on 2024-04-06 11:56:42
0001
0002
0003
0004
0005 int x3d( TString cut )
0006 {
0007
0008 int showFlag = 2;
0009
0010 return x3d( cut, showFlag );
0011
0012 }
0013
0014
0015 int x3d( TString cut, int showFlag )
0016 {
0017
0018
0019 TFile* alignedFile = new TFile("aligned.root");
0020 TTree* tmpTree = (TTree*)alignedFile->Get("theTree");
0021 TTree* alignedTree = (TTree*)tmpTree->CopyTree(cut);
0022
0023 TFile* misalignedFile = new TFile("misaligned.root");
0024 tmpTree = (TTree*)misalignedFile->Get("theTree");
0025 TTree* misalignedTree = (TTree*)tmpTree->CopyTree(cut);
0026
0027
0028 float x,y,z,phi,theta,length,thick,width;
0029 float mx,my,mz,mphi,mtheta,mlength,mthick,mwidth;
0030 TRotMatrix* rot;
0031 TRotMatrix* mrot;
0032 double rad2deg = 180./3.1415926;
0033
0034 alignedTree->SetBranchAddress( "x", &x );
0035 alignedTree->SetBranchAddress( "y", &y );
0036 alignedTree->SetBranchAddress( "z", &z );
0037 alignedTree->SetBranchAddress( "phi", &phi );
0038 alignedTree->SetBranchAddress( "theta", &theta );
0039 alignedTree->SetBranchAddress( "length", &length );
0040 alignedTree->SetBranchAddress( "width", &width );
0041 alignedTree->SetBranchAddress( "thick", &thick );
0042 alignedTree->SetBranchAddress( "rot", &rot );
0043
0044 misalignedTree->SetBranchAddress( "x", &mx );
0045 misalignedTree->SetBranchAddress( "y", &my );
0046 misalignedTree->SetBranchAddress( "z", &mz );
0047 misalignedTree->SetBranchAddress( "phi", &mphi );
0048 misalignedTree->SetBranchAddress( "theta", &mtheta );
0049 misalignedTree->SetBranchAddress( "length", &mlength );
0050 misalignedTree->SetBranchAddress( "width", &mwidth );
0051 misalignedTree->SetBranchAddress( "thick", &mthick );
0052 misalignedTree->SetBranchAddress( "rot", &mrot );
0053
0054
0055 TCanvas* c1 = new TCanvas("c1","Detector units", 200, 10, 700, 500);
0056 c1->cd();
0057
0058 TBRIK* IP = new TBRIK("IP","IP","void",0.,0.,0.);
0059 TNode* rootNode = new TNode("Root","Root","IP",0.,0.,0.);
0060 rootNode->cd();
0061
0062 int entry = 0;
0063 while ( alignedTree->GetEntry(entry) && misalignedTree->GetEntry(entry) )
0064 {
0065 entry++;
0066 std::ostringstream name;
0067
0068
0069 name << "aBrik" << entry;
0070 TBRIK* aBrik = new TBRIK(name.str().c_str(),"Aligned detector unit","void",
0071 0.01,0.01,length);
0072 aBrik->SetLineColor(4);
0073
0074
0075 name.str("aNode"); name << entry;
0076 TNode* aNode = new TNode(name.str().c_str(),name.str().c_str(),aBrik,x,y,z);
0077
0078 name.str("mBrik");
0079 name << entry;
0080 TBRIK* mBrik = new TBRIK(name.str().c_str(),"Misaligned detector unit","void",
0081 0.01,0.01,mlength);
0082 mBrik->SetLineColor(2);
0083
0084
0085 name.str("mNode"); name << entry;
0086 TNode* mNode = new TNode(name.str().c_str(),name.str().c_str(),mBrik,mx,my,mz);
0087
0088
0089 }
0090
0091 rootNode->cd();
0092 rootNode->Draw();
0093
0094 c1->GetViewer3D();
0095
0096 return 0;
0097
0098 }