]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Applying the trigger chamber response to the cluster and not to each pad
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Jul 2007 14:48:42 +0000 (14:48 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Jul 2007 14:48:42 +0000 (14:48 +0000)
of the cluster; moving this from AliMUONDigitizerV3 to AliMUONSDigitizerV2
(Diego)

MUON/AliMUONDigitizerV3.cxx
MUON/AliMUONDigitizerV3.h
MUON/AliMUONResponseTrigger.cxx
MUON/AliMUONResponseTrigger.h
MUON/AliMUONResponseTriggerV1.cxx
MUON/AliMUONSDigitizerV2.cxx

index 87d6d50c45f6203535acafa66de642220dc36ee7..29edc6a0cd79644165bca9cd405c5a077a383aa8 100644 (file)
@@ -26,7 +26,6 @@
 #include "AliMUONConstants.h"
 #include "AliMUONDigit.h"
 #include "AliMUONLogger.h"
-#include "AliMUONTriggerEfficiencyCells.h"
 #include "AliMUONTriggerElectronics.h"
 #include "AliMUONTriggerStoreV1.h"
 #include "AliMUONVCalibParam.h"
@@ -98,7 +97,6 @@ AliMUONDigitizerV3::AliMUONDigitizerV3(AliRunDigitizer* manager,
 fIsInitialized(kFALSE),
 fCalibrationData(0x0),
 fTriggerProcessor(0x0),
-fTriggerEfficiency(0x0),
 fNoiseFunction(0x0),
 fNoiseFunctionTrig(0x0),
   fGenerateNoisyDigits(generateNoisyDigits),
@@ -182,63 +180,6 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add
   digit.SetADC(adc);
 }
 
-//_____________________________________________________________________________
-void 
-AliMUONDigitizerV3::ApplyResponseToTriggerDigit(const AliMUONVDigitStore& digitStore,
-                                                AliMUONVDigit& digit)
-{
-  /// \todo add comment
-
-  if ( !fTriggerEfficiency ) return;
-
-  if (digit.IsEfficiencyApplied()) return;
-
-  AliMUONVDigit* correspondingDigit = FindCorrespondingDigit(digitStore,digit);
-
-  if (!correspondingDigit) return; //reject bad correspondences
-
-  Int_t detElemId = digit.DetElemId();
-
-  AliMpSegmentation* segmentation = AliMpSegmentation::Instance();
-  const AliMpVSegmentation* segment[2] = 
-  {
-    segmentation->GetMpSegmentation(detElemId,AliMp::GetCathodType(digit.Cathode())), 
-    segmentation->GetMpSegmentation(detElemId,AliMp::GetCathodType(correspondingDigit->Cathode()))
-  };
-
-  AliMpPad pad[2] = 
-  {
-    segment[0]->PadByIndices(AliMpIntPair(digit.PadX(),digit.PadY()),kTRUE), 
-    segment[1]->PadByIndices(AliMpIntPair(correspondingDigit->PadX(),correspondingDigit->PadY()),kTRUE)
-  };
-
-  Int_t p0(1);
-  if (digit.Cathode()==0) p0=0;
-
-  AliMpIntPair location = pad[p0].GetLocation(0);
-  Int_t nboard = location.GetFirst();
-
-  Bool_t isTrig[2];
-
-  fTriggerEfficiency->IsTriggered(detElemId, nboard, 
-                                  isTrig[0], isTrig[1]);
-  digit.EfficiencyApplied(kTRUE);
-  correspondingDigit->EfficiencyApplied(kTRUE);
-
-  if (!isTrig[digit.Cathode()])
-  {
-         digit.SetCharge(0);
-  }
-  
-  if ( &digit != correspondingDigit )
-  {
-         if (!isTrig[correspondingDigit->Cathode()])
-    {
-      correspondingDigit->SetCharge(0);
-         }
-  }
-}
-
 //_____________________________________________________________________________
 void
 AliMUONDigitizerV3::ApplyResponse(const AliMUONVDigitStore& store,
@@ -262,10 +203,7 @@ AliMUONDigitizerV3::ApplyResponse(const AliMUONVDigitStore& store,
     {
       ApplyResponseToTrackerDigit(*digit,kAddNoise);
     }
-    else
-    {
-      ApplyResponseToTriggerDigit(store,*digit);
-    }
+
     if ( digit->ADC() > 0  || digit->Charge() > 0 )
     {
       filteredStore.Add(*digit,AliMUONVDigitStore::kIgnore);
@@ -492,31 +430,6 @@ AliMUONDigitizerV3::Exec(Option_t*)
   fOutputDigitStore->Clear();
 }
 
-//_____________________________________________________________________________
-AliMUONVDigit* 
-AliMUONDigitizerV3::FindCorrespondingDigit(const AliMUONVDigitStore& digitStore,
-                                           AliMUONVDigit& digit) const
-{                                                
-  /// Find, if it exists, the digit corresponding to digit.Hit(), in the 
-  /// other cathode
-
-  AliCodeTimerAuto("")
-  
-  TIter next(digitStore.CreateIterator());
-  AliMUONVDigit* d;
-  
-  while ( ( d = static_cast<AliMUONVDigit*>(next()) ) )
-  {
-    if ( d->DetElemId() == digit.DetElemId() &&
-         d->Hit() == digit.Hit() &&
-         d->Cathode() != digit.Cathode() )
-    {
-      return d;
-    }      
-  }    
-  return 0x0;
-}
-
 
 //_____________________________________________________________________________
 void
@@ -804,20 +717,6 @@ AliMUONDigitizerV3::Init()
   }
   fTriggerProcessor = new AliMUONTriggerElectronics(fCalibrationData);
   
-  if ( muon()->GetTriggerEffCells() )
-  {
-    fTriggerEfficiency = fCalibrationData->TriggerEfficiency();
-    if ( fTriggerEfficiency )
-    {
-      AliDebug(1, "Will apply trigger efficiency");
-    }
-    else
-    {
-      AliFatal("I was requested to apply trigger efficiency, but I could "
-               "not get it !");
-    }
-  }
-  
   AliDebug(1, Form("Will %s generate noise-only digits for tracker",
                      (fGenerateNoisyDigits ? "":"NOT")));
 
index e63929716a85309d176019f3145240e39ca42d3f..73577aec5e6ca6ed6056b8f4688320f3379c5c1d 100644 (file)
@@ -19,7 +19,6 @@
 class AliMUONCalibrationData;
 class AliMUONVDigit;
 class AliMUONLogger;
-class AliMUONTriggerEfficiencyCells;
 class TClonesArray;
 class TF1;
 class TString;
@@ -55,15 +54,11 @@ private:
   void ApplyResponse(const AliMUONVDigitStore& store, AliMUONVDigitStore& filteredStore);
 
   void ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t addNoise);
-  void ApplyResponseToTriggerDigit(const AliMUONVDigitStore& digitStore, AliMUONVDigit& digit);
 
   AliLoader* GetLoader(const TString& foldername);
   
 private:  
 
-  AliMUONVDigit* FindCorrespondingDigit(const AliMUONVDigitStore& digitStore,
-                                       AliMUONVDigit& digit) const;
-
   void GenerateNoisyDigits(AliMUONVDigitStore& digitStore);
   void GenerateNoisyDigitsForOneCathode(AliMUONVDigitStore& digitStore, 
                                         Int_t detElemId, Int_t cathode);
@@ -77,7 +72,6 @@ private:
   Bool_t fIsInitialized; ///< are we initialized ?
   AliMUONCalibrationData* fCalibrationData; //!< pointer to access calib parameters
   AliMUONTriggerElectronics* fTriggerProcessor; ///< pointer to the trigger part of the job
-  AliMUONTriggerEfficiencyCells* fTriggerEfficiency; ///< trigger efficiency map  
   TF1* fNoiseFunction; //!< function to randomly get signal above n*sigma_ped
   TF1* fNoiseFunctionTrig; //!< function to get noise disribution on trig. chambers
   Int_t fGenerateNoisyDigits; //!< whether or not we should generate noise-only digits for tracker (1) and trigger (2)
index fd1f23833c7704494a81a0a9516f2c3c6de434e4..c46d286ac26dffc958e10afb79137afd6390924f 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONHit.h"
 #include "AliMUONConstants.h"
+#include "AliMUONTriggerEfficiencyCells.h"
 
 #include "AliMpPad.h"
 #include "AliMpCathodType.h"
@@ -68,7 +69,8 @@ namespace
 
 //------------------------------------------------------------------   
 AliMUONResponseTrigger::AliMUONResponseTrigger()
-  : AliMUONResponse()
+  : AliMUONResponse(),
+    fTriggerEfficiency(0x0)
 {
 /// Default constructor
 }
@@ -102,7 +104,9 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
   {
     twentyNano=1;
   }
-  
+
+  Bool_t isTrig[2]={kTRUE,kTRUE};
+
   for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
   {
     const AliMpVSegmentation* seg 
@@ -131,12 +135,36 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
     //FIXME : a trigger digit can have several locations. 
     //this is not currently supported by the digit class. Change that or not ?
     d->SetCharge(twentyNano);
+
+    if(fTriggerEfficiency){
+      if(cath==0){
+       Int_t nboard = pad.GetLocation(0).GetFirst();
+       fTriggerEfficiency->IsTriggered(detElemId, nboard, 
+                                       isTrig[0], isTrig[1]);
+      }
+      if(!isTrig[cath]) continue;
+    }
+
     digits.Add(d);   
   }
   
 }
 
 
+//_____________________________________________________________________________
+void
+AliMUONResponseTrigger::InitTriggerEfficiency(AliMUONTriggerEfficiencyCells *triggerEfficiency)
+{
+/// Initialize trigger chamber efficiency (on demand)
 
-
-
+  fTriggerEfficiency = triggerEfficiency;
+  if ( fTriggerEfficiency )
+  {
+    AliDebug(1, "Will apply trigger efficiency");
+  }
+  else
+  {
+    AliFatal("I was requested to apply trigger efficiency, but I could "
+            "not get it !");
+  }
+}
index 6a582800d62208657cb200e46849a3f8333666d9..19fe606036c7b58cc1e4d89d98ee0a1e0d3b3eb8 100644 (file)
@@ -11,6 +11,7 @@
 /// \brief Implementation of RPC response
 
 #include "AliMUONResponse.h"
+#include "AliMUONTriggerEfficiencyCells.h"
 
 class AliMUONResponseTrigger : public AliMUONResponse
 {
@@ -22,23 +23,20 @@ class AliMUONResponseTrigger : public AliMUONResponse
   virtual Int_t SetGenerCluster(){return 0;}
 
   virtual void DisIntegrate(const AliMUONHit& hit, TList& digits);
+
+  virtual void InitTriggerEfficiency(AliMUONTriggerEfficiencyCells* triggerEfficiency);
+
+ protected:
+  AliMUONTriggerEfficiencyCells* fTriggerEfficiency; //!< trigger efficiency map
   
  private:
+  /// Not implemented
+  AliMUONResponseTrigger(const AliMUONResponseTrigger& other);
+  /// Not implemented
+  AliMUONResponseTrigger& operator=(const AliMUONResponseTrigger& other); // assignment operator
+  
 
-  ClassDef(AliMUONResponseTrigger,1) // Implementation of RPC response
+  ClassDef(AliMUONResponseTrigger,2) // Implementation of RPC response
     
 };
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
index 0a20726ba7500369d0700dd3a34cc357baac672e..4d8070ec7cbb3c12df701e127343e7a36af7bd4c 100644 (file)
@@ -149,6 +149,8 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits
     twentyNano=1;
   }
 
+  Bool_t isTrig[2]={kTRUE, kTRUE};
+
   for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
   {
     const AliMpVSegmentation* seg 
@@ -165,6 +167,16 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits
     d->SetPadXY(ix,iy);
 
     d->SetCharge(twentyNano);
+
+    if(fTriggerEfficiency){
+      if(cath==0){
+       Int_t nboard = pad.GetLocation(0).GetFirst();
+       fTriggerEfficiency->IsTriggered(detElemId, nboard, 
+                                       isTrig[0], isTrig[1]);
+      }
+      if(!isTrig[cath]) continue;
+    }
+
     digits.Add(d);
 
     SetGenerCluster(); // 1 randum number per cathode (to be checked)
index a7a589f3065fc7c600eee8a977924c14db15647e..4a61a4dc16bc1ec8163eb395c2521d130ceaef4e 100644 (file)
 #include "AliMUONVDigitStore.h"
 #include "AliMUONVHitStore.h"
 
+#include "AliCDBManager.h"
+#include "AliMUONCalibrationData.h"
+#include "AliMUONResponseTrigger.h"
+
 //-----------------------------------------------------------------------------
 /// The sdigitizer performs the transformation from hits (energy deposits by
 /// the transport code) to sdigits (equivalent of charges on pad).
@@ -92,7 +96,17 @@ AliMUONSDigitizerV2::Exec(Option_t*)
   loader->LoadHits("READ");
   
   AliMUON* muon = static_cast<AliMUON*>(gAlice->GetModule("MUON"));
-    
+
+  AliMUONCalibrationData *calibrationData = 0x0;
+
+  if(muon->GetTriggerEffCells()){
+    Int_t runnumber = AliCDBManager::Instance()->GetRun();
+    calibrationData = new AliMUONCalibrationData(runnumber);
+    for (Int_t chamber = 10; chamber < 14; chamber++) {
+      ((AliMUONResponseTrigger *) (muon->Chamber(chamber).ResponseModel()))->InitTriggerEfficiency(calibrationData->TriggerEfficiency()); // Init trigger efficiency
+    }
+  }
+  
   Int_t nofEvents(runLoader->GetNumberOfEvents());
   
   TString classname = muon->DigitStoreClassName();
@@ -198,4 +212,6 @@ AliMUONSDigitizerV2::Exec(Option_t*)
   loader->UnloadHits();  
   
   delete sDigitStore;
+
+  if(calibrationData) delete calibrationData;
 }