From af217aa5f926fe178b324e294b7ba18d0a0471a1 Mon Sep 17 00:00:00 2001
From: Alexander Zinchenko <Alexander.Zinchenko@jinr.ru>
Date: Tue, 6 Dec 2016 12:10:03 +0400
Subject: [PATCH] Another version of Fill_TRAP

---
 macro/mpd/geometry/mpdshape.class.C | 35 +++++++++++++++++++++++++++++
 macro/mpd/geometry/mpdshape.class.h |  2 ++
 2 files changed, 37 insertions(+)

diff --git a/macro/mpd/geometry/mpdshape.class.C b/macro/mpd/geometry/mpdshape.class.C
index dce4dcd..386ea2b 100644
--- a/macro/mpd/geometry/mpdshape.class.C
+++ b/macro/mpd/geometry/mpdshape.class.C
@@ -56,6 +56,8 @@ public:
   void Clear();
   void Fill_TUBE(Double_t length_z, Double_t r_max, Double_t r_min);
   void Fill_TUBS(Double_t zmin, Double_t zmax, Double_t rmin,Double_t rmax, Double_t dr_st, Double_t dr_end);
+  void Fill_TRAP(Double_t dx11, Double_t dx12, Double_t dy1, Double_t dx21, Double_t dx22, 
+		 Double_t dy2, Double_t dz);
   void Fill_TRAP(Double_t x, Double_t X,Double_t x_small_f, Double_t x_large_f, Double_t yW, Double_t yW2,Double_t zW, Double_t zW2, Int_t ra);
   //void Fill_RECTRAP(Double_t x_small, Double_t x_large,Double_t xx_small, Double_t xx_large,
 	//	 Double_t yWidth, Double_t zWidth);	 
@@ -284,6 +286,39 @@ void Mpdshape::Fill_PGON( Double_t zmin, Double_t zmax, Double_t rmin, Double_t
    
 }
 
+//______________________________________________________________
+void Mpdshape::Fill_TRAP(Double_t dx11, Double_t dx12, Double_t dy1, Double_t dx21, Double_t dx22, 
+			 Double_t dy2, Double_t dz)
+{
+  // Fill trapezoid TRAP
+
+  fPoints.clear();
+  std::ostringstream o;
+  o.setf(ios::showpoint); 
+  o.setf(ios::fixed);
+  o.precision(10);
+
+  // trapezoid:    -dz                               dz                         
+           //     2*dx12                           2*dx22
+           // _____________  dy1              ________________  dy2
+           // \           / ^                 \              /  
+           //  \         /  | y  /z            \            /   ^
+           //   \       /                       \          /    | y
+           //    \_____/   -dy1                  \        /     |
+           //     2*dx11                          \      /
+           //                                      \____/      -dy2
+  o << dx11 << " " << -dy1 << " " << 0. << endl
+    << dx12 << " " << dy1 << " " << 0. << endl
+    << -dx12 << " " << dy1 << " " << 0. << endl
+    << -dx11 << " " << -dy1 << " " << 0. << endl
+    
+    << dx21 << " " << -dy2 << " " << dz << endl
+    << dx22 << " " << dy2 << " " << dz << endl
+    << -dx22 << " " << dy2 << " " << dz << endl
+    << -dx21 << " " << -dy2 << " " << dz;
+  fPoints = o.str();
+}
+
 //______________________________________________________________
 void Mpdshape::Fill_TRAP(Double_t x_small, Double_t x_large,Double_t x_large_f, Double_t x_small_f,
 			 Double_t yWidth, Double_t yWidth2,Double_t zWidth, Double_t /*zWidth2*/,
diff --git a/macro/mpd/geometry/mpdshape.class.h b/macro/mpd/geometry/mpdshape.class.h
index 7d5f142..132fc8b 100644
--- a/macro/mpd/geometry/mpdshape.class.h
+++ b/macro/mpd/geometry/mpdshape.class.h
@@ -55,6 +55,8 @@ public:
   void Clear();
   void Fill_TUBE(Double_t length_z, Double_t r_max, Double_t r_min);
   void Fill_TUBS(Double_t zmin, Double_t zmax, Double_t rmin,Double_t rmax, Double_t dr_st, Double_t dr_end);
+  void Fill_TRAP(Double_t dx11, Double_t dx12, Double_t dy1, Double_t dx21, Double_t dx22, 
+		 Double_t dy2, Double_t dz);
   void Fill_TRAP(Double_t x, Double_t X,Double_t x_small_f, Double_t x_large_f, Double_t yW, Double_t yW2,Double_t zW, Double_t zW2, Int_t ra);
   //void Fill_RECTRAP(Double_t x_small, Double_t x_large,Double_t xx_small, Double_t xx_large,
 	//	 Double_t yWidth, Double_t zWidth);	 
-- 
GitLab