Wrapper for AliMagFCheb: set of magnetic field data + Tosca parameterization by Cheby...
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Apr 2008 11:05:36 +0000 (11:05 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Apr 2008 11:05:36 +0000 (11:05 +0000)
(R. Shahoyan)

STEER/AliMagWrapCheb.cxx [new file with mode: 0644]
STEER/AliMagWrapCheb.h [new file with mode: 0644]
STEER/STEERLinkDef.h
STEER/libSTEER.pkg

diff --git a/STEER/AliMagWrapCheb.cxx b/STEER/AliMagWrapCheb.cxx
new file mode 100644 (file)
index 0000000..0bb238b
--- /dev/null
@@ -0,0 +1,118 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include <TClass.h>
+#include <TFile.h>
+#include <TSystem.h>
+
+#include "AliMagWrapCheb.h"
+#include "AliLog.h"
+
+ClassImp(AliMagWrapCheb)
+    
+
+//_______________________________________________________________________
+AliMagWrapCheb::AliMagWrapCheb():
+  AliMagF(),
+  fMeasuredMap(0)
+{
+  // Default constructor
+  //
+}
+
+//_______________________________________________________________________
+AliMagWrapCheb::AliMagWrapCheb(const char *name, const char *title, Int_t integ, 
+                              Float_t factor, Float_t fmax, Int_t map, 
+                              Bool_t dipoleON,const char* path):
+  AliMagF(name, title, integ, factor, fmax),
+  fMeasuredMap(0)
+{
+  //
+  fMap = map;
+  char* fname = gSystem->ExpandPathName(path);
+  TFile* file = TFile::Open(fname);
+  if (!file) {
+    AliError(Form("Failed to open magnetic field data file %s\n",fname)); 
+    return;
+  }
+  const char* parname = 0;
+  if      (fMap == k2kG) parname = dipoleON ? "Sol12_Dip6_Hole":"Sol12_Dip0_Hole";
+  else if (fMap == k5kG) parname = dipoleON ? "Sol30_Dip6_Hole":"Sol30_Dip0_Hole";
+  else {
+    AliError(Form("Unknown field identifier %d is requested\n",fMap)); 
+    return;
+  }
+  //
+  fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get(parname));
+  if (!fMeasuredMap) {
+    AliError(Form("Did not find field %s in %s\n",parname,fname)); 
+    return;
+  }
+  file->Close();
+  delete file;
+}
+
+
+//_______________________________________________________________________
+AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb &src):
+  AliMagF(src),
+  fMeasuredMap(0)
+{
+  if (src.fMeasuredMap) fMeasuredMap = new AliMagFCheb(*src.fMeasuredMap);
+}
+
+//_______________________________________________________________________
+AliMagWrapCheb::~AliMagWrapCheb()
+{
+  delete fMeasuredMap;
+}
+
+//_______________________________________________________________________
+void AliMagWrapCheb::GetTPCInt(Float_t *xyz, Float_t *b) const
+{
+  // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
+  //
+  if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b);
+  for (int i=3;i--;) b[i] *= fFactor;
+}
+
+//_______________________________________________________________________
+void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const
+{
+  // Method to calculate the integral of magnetic integral from point to nearest cathode plane
+  // in cylindrical coordiates ( -pi<phi<pi convention )
+  if (fMeasuredMap) fMeasuredMap->GetTPCIntCyl(rphiz,b);
+  for (int i=3;i--;) b[i] *= fFactor;
+}
+
+//_______________________________________________________________________
+void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const
+{
+  // Method to calculate the field at point  xyz
+  //
+  if (fMeasuredMap) fMeasuredMap->Field(xyz,b);
+  for (int i=3;i--;) b[i] *= fFactor;
+}
+
+//_______________________________________________________________________
+AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps)
+{
+  if (this != &maps && maps.fMeasuredMap) { 
+    if (fMeasuredMap) delete fMeasuredMap;
+    fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap);
+  }
+  return *this;
+}
diff --git a/STEER/AliMagWrapCheb.h b/STEER/AliMagWrapCheb.h
new file mode 100644 (file)
index 0000000..52f2a67
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef ALIMAGWRAPCHEB_H
+#define ALIMAGWRAPCHEB_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//
+// Wrapper for AliMagFCheb: set of magnetic field data + Tosca parameterization by Chebyshev polynomials
+// 
+// Author: ruben.shahoyan@cern.ch
+//
+
+#include "AliMagF.h"
+#include "AliMagFCheb.h"
+
+
+class AliMagWrapCheb : public AliMagF
+{
+public:
+  enum constants {k2kG, k5kG};
+  AliMagWrapCheb();
+  AliMagWrapCheb(const char *name, const char *title, Int_t integ,
+                Float_t factor=1, Float_t fmax=15, Int_t map = k2kG,
+                Bool_t dipoleON = kTRUE,
+                const char* path="$(ALICE_ROOT)/data/maps/mfchebKGI.root");
+  AliMagWrapCheb(const AliMagWrapCheb& maps);             
+  AliMagWrapCheb& operator=(const AliMagWrapCheb& maps);
+  virtual ~AliMagWrapCheb();
+  //
+  virtual void Field(Float_t *x, Float_t *b)              const;
+  virtual void GetTPCInt(Float_t *xyz, Float_t *b)        const;
+  virtual void GetTPCIntCyl(Float_t *rphiz, Float_t *b)   const;
+  //
+  AliMagFCheb* GetMeasuredMap()                           const {return fMeasuredMap;}
+  void SetMeasuredMap(AliMagFCheb* parm)                        {if (parm) delete parm; fMeasuredMap = parm;}
+  //
+ protected:
+  AliMagFCheb* fMeasuredMap;     // Measured part of the field map
+  //   
+  ClassDef(AliMagWrapCheb, 1)    // Class for all Alice MagField wrapper for measured data + Tosca parameterization
+};
+
+
+#endif
index 1a2c0d8..f0f9292 100644 (file)
@@ -33,6 +33,7 @@
 #pragma link C++ class  AliMagFCheb+;
 #pragma link C++ class  AliCheb3DCalc+;
 #pragma link C++ class  AliCheb3D+;
+#pragma link C++ class  AliMagWrapCheb+;
 #pragma link C++ class  AliLego+;
 #pragma link C++ class  AliLegoGenerator+;
 #pragma link C++ class  AliLegoGeneratorXYZ+;
index bc3b29e..24b51dd 100644 (file)
@@ -46,6 +46,7 @@ AliTracker.cxx AliCluster.cxx AliCluster3D.cxx \
 AliHelix.cxx AliV0.cxx AliKink.cxx \
 AliSelectorRL.cxx \
 AliMagFMapsV1.cxx \
+AliMagWrapCheb.cxx \
 AliSurveyObj.cxx AliSurveyPoint.cxx \
 AliFstream.cxx \
 AliCTPRawData.cxx \