]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONResponseV0.cxx
example macros for EVE analysis using new ListAnalyser (Ben)
[u/mrichter/AliRoot.git] / MUON / AliMUONResponseV0.cxx
index 39ae1300787e065370af6a8a9e740fad4f15774b..8522676bcd9926ea29c5fa6dffa95bae610405b2 100644 (file)
 
 /* $Id$ */
 
-// --------------------------
+//-----------------------------------------------------------------------------
 // Class AliMUONResponseV0
 // --------------------------
 // Implementation of 
 // Mathieson response
+//-----------------------------------------------------------------------------
 
 #include "AliMUONResponseV0.h"
 #include "AliMUON.h"
 #include "AliMUONConstants.h"
 #include "AliMUONDigit.h"
-#include "AliMUONGeometrySegmentation.h"
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONHit.h"
-#include "AliMUONSegmentation.h"
 
 #include "AliMpArea.h"
 #include "AliMpDEManager.h"
@@ -67,12 +66,6 @@ void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
   transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
 }
 
-AliMUONSegmentation* Segmentation()
-{
-  static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
-  return segmentation;
-}
-
 //__________________________________________________________________________
 AliMUONResponseV0::AliMUONResponseV0()
   : AliMUONResponse(),
@@ -85,12 +78,41 @@ AliMUONResponseV0::AliMUONResponseV0()
   fZeroSuppression(0),
   fChargeCorrel(0.0),
   fMathieson(new AliMUONMathieson),
-  fChargeThreshold(1e-4)
+  fChargeThreshold(1e-4),
+  fIsTailEffect(kFALSE)
 {
     /// Normal constructor
     AliDebug(1,Form("Default ctor"));
 }
 
+//__________________________________________________________________________
+AliMUONResponseV0::AliMUONResponseV0(const AliMUONResponseV0& other)
+: AliMUONResponse(),
+fChargeSlope(0.0),
+fChargeSpreadX(0.0),
+fChargeSpreadY(0.0),
+fSigmaIntegration(0.0),
+fMaxAdc(0),
+fSaturation(0),
+fZeroSuppression(0),
+fChargeCorrel(0.0),
+fMathieson(0),
+fChargeThreshold(1e-4),
+fIsTailEffect(kFALSE)
+{
+  /// copy ctor
+  other.CopyTo(*this);
+}
+
+//__________________________________________________________________________
+AliMUONResponseV0& 
+AliMUONResponseV0::operator=(const AliMUONResponseV0& other)
+{
+  /// Assignment operator
+  other.CopyTo(*this);
+  return *this;
+}
+
 //__________________________________________________________________________
 AliMUONResponseV0::~AliMUONResponseV0()
 {
@@ -100,6 +122,24 @@ AliMUONResponseV0::~AliMUONResponseV0()
   delete fMathieson;
 }
 
+//______________________________________________________________________________
+void
+AliMUONResponseV0::CopyTo(AliMUONResponseV0& other) const
+{
+  /// Copy *this to other
+  other.fChargeSlope=fChargeSlope;
+  other.fChargeSpreadX=fChargeSpreadX;
+  other.fChargeSpreadY=fChargeSpreadY;
+  other.fSigmaIntegration=fSigmaIntegration;
+  other.fMaxAdc=fMaxAdc;
+  other.fSaturation=fSaturation;
+  other.fZeroSuppression=fZeroSuppression;
+  other.fChargeCorrel=fChargeCorrel;
+  delete other.fMathieson;
+  other.fMathieson = new AliMUONMathieson(*fMathieson);
+  other.fChargeThreshold=fChargeThreshold;
+}
+
 //______________________________________________________________________________
 void
 AliMUONResponseV0::Print(Option_t*) const
@@ -148,17 +188,6 @@ Float_t AliMUONResponseV0::IntPH(Float_t eloss) const
   return charge;
 }
 
-  //-------------------------------------------
-Float_t AliMUONResponseV0::IntXY(Int_t idDE,
-                                AliMUONGeometrySegmentation* segmentation) 
-const
-{
- /// Calculate charge on current pad according to Mathieson distribution
-
-  return fMathieson->IntXY(idDE, segmentation);
-}
-
-
 //_____________________________________________________________________________
 Float_t
 AliMUONResponseV0::GetAnod(Float_t x) const
@@ -182,18 +211,56 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits)
   digits.Clear();
   
   Int_t detElemId = hit.DetElemId();
-  
+  Double_t hitX = hit.X() ;
+  Double_t hitY = hit.Y() ;
+  Double_t hitZ = hit.Z() ;
+
   // Width of the integration area
   Double_t dx = SigmaIntegration()*ChargeSpreadX();
   Double_t dy = SigmaIntegration()*ChargeSpreadY();
   
+  //Modify to take the tailing effect.
+  if(fIsTailEffect){
+    Double_t locX,locY,locZ,globXCenter,globYCenter,globZ;
+    Int_t para = 5; // This parameter is a natural number(excluding zero), higher the value less is the tailing effect 
+    Double_t termA = 1.0;
+    Double_t termB = 1.0;
+    if(para>0){
+      for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
+       {
+         // Get an iterator to loop over pads, within the given area.
+         const AliMpVSegmentation* seg = 
+           AliMpSegmentation::Instance()
+           ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
+         AliMp::PlaneType plane = seg->PlaneType();
+         
+         if(plane == AliMp::kBendingPlane) {
+           Global2Local(detElemId,hitX,hitY,hitZ,locX,locY,locZ);
+           AliMpPad pad = seg->PadByPosition(locX,locY,kFALSE);
+            if(pad.IsValid()){
+              Double_t locYCenter = pad.GetPositionY();
+              Double_t locXCenter = pad.GetPositionX();
+              const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
+              transformer->Local2Global(detElemId,locXCenter,locYCenter,locZ,globXCenter,globYCenter,globZ);
+              for(Int_t itime = 0; itime<para; itime++)
+                termA *= 10.0;
+            
+              for(Int_t itime = 0; itime<Int_t((2*para) + 1); itime++)
+                termB *= (hitY - globYCenter) ; 
+            
+              hitY = hitY + termA*termB;
+            }// if the pad is a valid one
+         }// if bending plane
+       }// cathode loop
+    }// if para > 0 condn
+  }// if tail effect
+
   // Use that (dx,dy) to specify the area upon which
   // we will iterate to spread charge into.
   Double_t x,y,z;
-  Global2Local(detElemId,hit.X(),hit.Y(),hit.Z(),x,y,z);
+  Global2Local(detElemId,hitX,hitY,hitZ,x,y,z);
   x = GetAnod(x);
-  TVector2 hitPosition(x,y);
-  AliMpArea area(hitPosition,TVector2(dx,dy));
+  AliMpArea area(x,y,dx,dy);
   
   // Get pulse height from energy loss.
   Float_t qtot = IntPH(hit.Eloss());
@@ -224,7 +291,8 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits)
     if ( it->IsDone() )
     {
       // Exceptional case : iterator is built, but is invalid from the start.
-      AliMpPad pad = seg->PadByPosition(area.Position(),kFALSE);
+      AliMpPad pad = seg->PadByPosition(area.GetPositionX(),area.GetPositionY(),
+                                        kFALSE);
       if ( pad.IsValid() )
       {
         AliWarning(Form("Got an invalid iterator bug (area.Position() is within "
@@ -236,8 +304,8 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits)
         AliError(Form("Got an invalid iterator bug for detElemId %d cath %d."
                       "Might be a bad hit ? area.Position()=(%e,%e) "
                       "Dimensions()=(%e,%e)",
-                      detElemId,cath,area.Position().X(),area.Position().Y(),
-                      area.Dimensions().X(),area.Dimensions().Y()));
+                      detElemId,cath,area.GetPositionX(),area.GetPositionY(),
+                      area.GetDimensionX(),area.GetDimensionY()));
       }
       delete it;
       return;
@@ -248,8 +316,9 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits)
       // For each pad given by the iterator, compute the charge of that
       // pad, according to the Mathieson distribution.
       AliMpPad pad = it->CurrentItem();      
-      TVector2 lowerLeft(hitPosition-pad.Position()-pad.Dimensions());
-      TVector2 upperRight(lowerLeft + pad.Dimensions()*2.0);
+      TVector2 lowerLeft(TVector2(x,y)-TVector2(pad.GetPositionX(),pad.GetPositionY())-
+                         TVector2(pad.GetDimensionX(),pad.GetDimensionY()));
+      TVector2 upperRight(lowerLeft + TVector2(pad.GetDimensionX(),pad.GetDimensionY())*2.0);
       Float_t qp = TMath::Abs(fMathieson->IntXY(lowerLeft.X(),lowerLeft.Y(),
                                                 upperRight.X(),upperRight.Y()));
             
@@ -259,15 +328,10 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits)
       {
         // If we're above threshold, then we create a digit,
         // and fill it with relevant information, including electronics.
-        AliMUONDigit* d = new AliMUONDigit;
-        d->SetDetElemId(detElemId);
-        d->SetPadX(pad.GetIndices().GetFirst());
-        d->SetPadY(pad.GetIndices().GetSecond());
-        d->SetSignal(icharge);
-        d->AddPhysicsSignal(d->Signal());
-        d->SetCathode(cath);
-        d->SetElectronics(pad.GetLocation().GetFirst(),
-                          pad.GetLocation().GetSecond());
+        AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetManuId(),
+                                           pad.GetManuChannel(),cath);
+        d->SetPadXY(pad.GetIx(),pad.GetIy());
+        d->SetCharge(icharge);
         digits.Add(d);   
       }       
       it->Next();