]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for #87331: Combined commit MUON+HLT
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Oct 2011 11:15:23 +0000 (11:15 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Oct 2011 11:15:23 +0000 (11:15 +0000)
AliMUONDigitCalibrator

  Simplified the ctors interface (removed a default parameter)

AliMUONReconstructor

  Propagate AliMUONDigitCalibrator interface change
  Change order of delete calls in the destructors (to avoid access dead OCDB objects in dtor of calibrator)

AliMUONTrackerDataMaker

  Propagate AliMUONDigitCalibrator interface change

AliMUON

  Propagate changes in AliMUONDigitizerV3 (e.g. pass the recoparams when creating the digitizer)

AliMUONVDigit
AliMUONRealDigit
AliMUONDigit

All digits now have the ChargeInFC method defined

AliMUONDigitizerV3

  Now uses the RecoParams to know how to decalibrate.
  Now assumes that all digits to be decalibrated have their charge in fC, as it should be...

AliMUONSDigitizerV2
AliMUONResponseV0

  Simulated charges are now in fC.

runSimulation.C
runReconstruction.C
AlirootRun_MUONtest.sh

  One more step towards removal of specific OCDB storages for simulations : take
  MUON/Calib/Gains from raw OCDB.
  Added an option "-b anchorRunNumber" to AlirootRun_MUONtest.sh in order to test realistic simulations
  (i.e. using an anchor run). Note that this option references a couple of "private" OCDB files. This is
  only an interim solution...

Config.C

  Added a parameter to know when we're doing realistic simulations, in which case we must
  instantiante the ITS to get the correct propagation of the simulated vertex to the reconstruction.

AliMUONRecoParam.cxx

  Added eventspecie to Print()

Laurent

20 files changed:
HLT/MUON/OnlineAnalysis/AliHLTMUONClusterFinderComponent.cxx
MUON/AliMUON.cxx
MUON/AliMUON.h
MUON/AliMUONDigitCalibrator.cxx
MUON/AliMUONDigitCalibrator.h
MUON/AliMUONDigitizerV3.cxx
MUON/AliMUONDigitizerV3.h
MUON/AliMUONRealDigit.h
MUON/AliMUONRecoParam.cxx
MUON/AliMUONReconstructor.cxx
MUON/AliMUONResponseV0.cxx
MUON/AliMUONSDigitizerV2.cxx
MUON/AliMUONTrackerDataMaker.cxx
MUON/AliMUONVDigit.cxx
MUON/AliMUONVDigit.h
MUON/AlirootRun_MUONtest.sh
MUON/Config.C
MUON/MUONefficiency.C
MUON/runReconstruction.C
MUON/runSimulation.C

index d5cb8073fb043f2972e2386c67a2bc82ac8ed6cb..42d23a1d004f92ce0a3a7f4b6e4d6db6fecf5087 100644 (file)
@@ -592,9 +592,7 @@ int AliHLTMUONClusterFinderComponent::ReadConfigFromCDB(
                AliMUONSimpleClusterServer* clusterServer = NULL;
                try
                {
-                       calibrator = new AliMUONDigitCalibrator(
-                                       *fCalibrationData, fRecoParam->GetCalibrationMode()
-                               );
+                       calibrator = new AliMUONDigitCalibrator(*fCalibrationData, fRecoParam);
                
                        clusterFinder = AliMUONReconstructor::CreateClusterFinder(
                                        fRecoParam->GetClusteringMode()
index adb3ab3c580a259e54507528983de67b9f707cfe..31c0bb3417fb19f6c64b0b3b3b85743f35aab073 100644 (file)
@@ -445,7 +445,7 @@ AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const
   
   AliMUONDigitizerV3* digitizer = new AliMUONDigitizerV3(manager, fDigitizerWithNoise);
   AliMUONDigitizerV3::SetNSigmas(fDigitizerNSigmas);
-  digitizer->SetCalibrationData(fCalibrationData);
+  digitizer->SetCalibrationData(fCalibrationData,GetRecoParam());
   return digitizer;
 }
 
@@ -540,34 +540,14 @@ Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader)
        
   if (!fDigitCalibrator)
   {
-    AliMUONRecoParam* recoParam = 0x0;
-    
-    AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam");
-    
-    if (entry) 
-    {      
-      // load recoParam according OCDB content (single or array)
-      if (!(recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject()))) 
-      {        
-        TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject());
-        
-        for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); ++i)
-        {
-          recoParam = static_cast<AliMUONRecoParam*>(recoParamArray->UncheckedAt(i));
-          if (recoParam && recoParam->IsDefault()) break;
-          recoParam = 0x0;
-        }        
-      }      
-    }
+    AliMUONRecoParam* recoParam = GetRecoParam();
     
     if (!recoParam)
     {
       AliFatal("Cannot work without recoparams !");
     }
     
-    TString calibMode = recoParam->GetCalibrationMode();
-  
-    fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam,calibMode.Data());
+    fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam);
   }
   
        fDigitMaker->Raw2Digits(rawReader,sDigitStore,triggerStore);
@@ -667,4 +647,29 @@ Int_t  AliMUON::GetDigitizerWithNoise() const
     
 }  
 
+//____________________________________________________________________
+AliMUONRecoParam* AliMUON::GetRecoParam() const
+{
+  AliMUONRecoParam* recoParam = 0x0;
+
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam");
+
+  if (entry) 
+  {      
+    // load recoParam according OCDB content (single or array)
+    if (!(recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject()))) 
+    {        
+      TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject());
+      
+      for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); ++i)
+      {
+        recoParam = static_cast<AliMUONRecoParam*>(recoParamArray->UncheckedAt(i));
+        if (recoParam && recoParam->IsDefault()) break;
+        recoParam = 0x0;
+      }        
+    }      
+  }
+  return recoParam;
+}
+
 
index 2763d39d729468b6ab8e42ca573dff9bb81777ea..99a6233c45e0141c9ff4d9f19c5d5730ccdfcca8 100644 (file)
@@ -28,6 +28,7 @@ class AliMUONDigitMaker;
 class AliMUONVHitStore;
 class AliMUONCalibrationData;
 class AliMUONDigitCalibrator;
+class AliMUONRecoParam;
 
 class AliLoader;
 
@@ -150,6 +151,8 @@ class AliMUON : public  AliDetector
 
     const AliMUONGeometry* GetGeometry() const;
 
+  AliMUONRecoParam* GetRecoParam() const;
+  
     Int_t                 fNCh;                ///< Number of chambers   
     Int_t                 fNTrackingCh;        ///< Number of tracking chambers*
     Int_t                 fSplitLevel;         ///< Splitlevel when making branches in outfiles.
@@ -192,9 +195,9 @@ class AliMUON : public  AliDetector
     
     AliMUONCalibrationData* fCalibrationData; ///< pointer of calibration data
 
-  AliMUONDigitCalibrator* fDigitCalibrator; ///< digit calibrator (for raw2sdigits)
+  AliMUONDigitCalibrator* fDigitCalibrator; //!< digit calibrator (for raw2sdigits)
   
-    ClassDef(AliMUON,24)  // MUON Detector base class
+    ClassDef(AliMUON,25)  // MUON Detector base class
 };
 #endif
 
index aff3997a523f3fc3b534008ad584f59c61b2155e..86a4d62198fe5c59035fe96eb04f601f2672d955 100644 (file)
@@ -68,7 +68,7 @@ const Int_t AliMUONDigitCalibrator::fgkGain(2);
 const Int_t AliMUONDigitCalibrator::fgkInjectionGain(3);
 
 //_____________________________________________________________________________
-AliMUONDigitCalibrator::AliMUONDigitCalibrator(Int_t runNumber, const char* calibMode)
+AliMUONDigitCalibrator::AliMUONDigitCalibrator(Int_t runNumber)
 : TObject(),
 fLogger(new AliMUONLogger(20000)),
 fStatusMaker(0x0),
@@ -93,6 +93,7 @@ fMask(0)
     if ( o->IsA() == TObjArray::Class() )
     {
       TObjArray* a = static_cast<TObjArray*>(o);
+//      a->SetOwner(kTRUE); // FIXME: this should be done but somehow makes the reco crash at the end at cleaning stage... investigate why ?
       TIter next(a);
       AliMUONRecoParam* p;
       while ( ( p = static_cast<AliMUONRecoParam*>(next()) ))
@@ -115,13 +116,12 @@ fMask(0)
   
   AliMUONCalibrationData calib(runNumber);
   
-  Ctor(calibMode,calib,recoParam,kFALSE);
+  Ctor(calib,recoParam,kFALSE);
 }
 
 //_____________________________________________________________________________
 AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib,
-                                               const AliMUONRecoParam* recoParams,
-                                               const char* calibMode)
+                                               const AliMUONRecoParam* recoParams)
 : TObject(),
 fLogger(new AliMUONLogger(20000)),
 fStatusMaker(0x0),
@@ -137,12 +137,11 @@ fMask(0)
 {
   /// ctor
   
-  Ctor(calibMode,calib,recoParams);
+  Ctor(calib,recoParams);
 }
 
 //_____________________________________________________________________________
-AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib,
-                                               const char* calibMode)
+AliMUONDigitCalibrator::AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, int /*b*/)
 : TObject(),
 fLogger(new AliMUONLogger(20000)),
 fStatusMaker(0x0),
@@ -158,19 +157,19 @@ fMask(0)
 {
   /// ctor
   
-  Ctor(calibMode,calib,0x0);
+  Ctor(calib,0x0);
 }
 
 //_____________________________________________________________________________
 void
-AliMUONDigitCalibrator::Ctor(const char* calibMode,
-                             const AliMUONCalibrationData& calib,
+AliMUONDigitCalibrator::Ctor(const AliMUONCalibrationData& calib,
                              const AliMUONRecoParam* recoParams,
                              Bool_t deferredInitialization)
 {
   /// designated ctor
   
-  TString cMode(calibMode);
+  TString cMode("NOGAIN");
+  if (recoParams) cMode=recoParams->GetCalibrationMode();
   cMode.ToUpper();
   
   if ( cMode == "NOGAIN" ) 
@@ -195,7 +194,7 @@ AliMUONDigitCalibrator::Ctor(const char* calibMode,
        }  
   else
   {
-    AliError(Form("Invalid calib mode = %s. Will use NOGAIN instead",calibMode));
+    AliError(Form("Invalid calib mode = %s. Will use NOGAIN instead",cMode.Data()));
     fApplyGains = fgkNoGain;
   }
   
@@ -292,6 +291,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore)
     }
     
     digit->Calibrated(kTRUE);
+    digit->ChargeInFC(kTRUE);
     
     Float_t charge(0.0);
     Int_t statusMap;
@@ -302,7 +302,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore)
     Bool_t ok = IsValidDigit(digit->DetElemId(),digit->ManuId(),digit->ManuChannel(),&statusMap);
     
     digit->SetStatusMap(statusMap);
-    
+
     if (ok)
     {
       charge = CalibrateDigit(digit->DetElemId(),digit->ManuId(),digit->ManuChannel(),
@@ -315,6 +315,7 @@ AliMUONDigitCalibrator::Calibrate(AliMUONVDigitStore& digitStore)
     
     digit->SetCharge(charge);
     digit->Saturated(isSaturated);
+    
   }
 }
 
@@ -455,6 +456,9 @@ AliMUONDigitCalibrator::IsValidDigit(Int_t detElemId, Int_t manuId, Int_t manuCh
 {
   /// Check if a given pad is ok or not.
   
+  // initialize the statusmap to dead by default
+  if (statusMap) *statusMap = AliMUONPadStatusMapMaker::SelfDeadMask();
+
   // First a protection against bad input parameters
   AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
   if (!de) return kFALSE; // not existing DE
@@ -473,7 +477,7 @@ AliMUONDigitCalibrator::IsValidDigit(Int_t detElemId, Int_t manuId, Int_t manuCh
   // ok, now we have a valid channel number, so let's see if that pad
   // behaves or not ;-)
   
-  Int_t sm = fStatusMapMaker->StatusMap(detElemId,manuId,manuChannel);
+  Int_t sm = StatusMap(detElemId,manuId,manuChannel);
   
   if (statusMap) *statusMap = sm;
   
index d55b09902dbd0be120c91eeb83dc00340042e22f..2ff057fa92aa1b4820d7c3c9f89bfe50feb1afc1 100644 (file)
@@ -30,14 +30,12 @@ class AliMUONDigitCalibrator : public TObject
 {
 public:
 
-  AliMUONDigitCalibrator(Int_t runNumber, const char* calibMode="NOGAIN");
+  AliMUONDigitCalibrator(Int_t runNumber);
   
   AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, 
-                         const AliMUONRecoParam* recoParams,
-                         const char* calibMode="NOGAIN");
+                         const AliMUONRecoParam* recoParams);
   
-  AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, 
-                         const char* calibMode="NOGAIN");
+  AliMUONDigitCalibrator(const AliMUONCalibrationData& calib, int b);
   
   virtual ~AliMUONDigitCalibrator();
   
@@ -61,8 +59,7 @@ private:
   /// Not implemented
   AliMUONDigitCalibrator& operator=(const AliMUONDigitCalibrator& other);
   
-  void Ctor(const char* calibMode,
-            const AliMUONCalibrationData& calib,
+  void Ctor(const AliMUONCalibrationData& calib,
             const AliMUONRecoParam* recoParams,
             Bool_t deferredInitialization=kTRUE);
   
index 172bdc9bb3c56b7ecd3a5d99dae8cf37113b0e9a..4f4ac60dd84546e993be48ac9957cf54cb681225 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliMUONVCalibParam.h"
 #include "AliMUONVDigitStore.h"
 #include "AliMUONGeometryTransformer.h" //ADDED for trigger noise
+#include "AliMUONRecoParam.h"
 #include "AliMUONTriggerChamberEfficiency.h"
 #include "AliMUONTriggerUtilities.h"
 
@@ -61,6 +62,7 @@
 
 //-----------------------------------------------------------------------------
 /// \class AliMUONDigitizerV3
+///
 /// The digitizer is performing the transformation to go from SDigits (digits
 /// w/o any electronic noise) to Digits (w/ electronic noise, and decalibration)
 /// 
 /// (for performance reason mainly, and because anyway we know we have to do it
 /// here, at the digitization level).
 ///
+/// August 2011. In order to remove the need for specific MC OCDB storages,
+/// we're introducing a dependence of simulation on AliMUONRecoParam (stored
+/// in MUON/Calib/RecoParam in OCDB), which is normally (or conceptually, if
+/// you will) only a reconstruction object. That's not a pretty solution, but,
+/// well, we have to do it...
+/// This dependence comes from the fact that we must know how to decalibrate
+/// the digits, so that the decalibration (done here) - calibration (done during
+/// reco) process is (as much as possible) neutral.
+///
+///
 /// \author Laurent Aphecetche
+///
 //-----------------------------------------------------------------------------
 
 namespace
@@ -110,6 +123,7 @@ fTriggerStore(new AliMUONTriggerStoreV1),
 fDigitStore(0x0),
 fOutputDigitStore(0x0),
 fInputDigitStores(0x0),
+fRecoParam(0x0),
 fTriggerEfficiency(0x0),
 fTriggerUtilities(0x0),
 fEfficiencyResponse(2*AliMUONConstants::NTriggerCh()*AliMUONConstants::NTriggerCircuit())
@@ -153,7 +167,14 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add
   /// - add some electronics noise (thus leading to a realistic adc), if requested to do so
   /// - sets the signal to zero if below 3*sigma of the noise
 
-  Float_t charge = digit.IsChargeInFC() ? digit.Charge()*AliMUONConstants::FC2ADC() : digit.Charge();
+  Float_t charge = digit.Charge();
+  
+  if (!digit.IsChargeInFC())
+  {
+    charge *= AliMUONConstants::DefaultADC2MV()*AliMUONConstants::DefaultA0()*AliMUONConstants::DefaultCapa();
+    fLogger->Log("CHECK ME ! WAS NOT SUPPOSED TO BE HERE !!! ARE YOU RECONSTRUCTING OLD SIMULATIONS ? ");
+    AliError("CHECK ME ! WAS NOT SUPPOSED TO BE HERE !!! ARE YOU RECONSTRUCTING OLD SIMULATIONS ? ");
+  }
   
   // We set the charge to 0, as the only relevant piece of information
   // after Digitization is the ADC value.  
@@ -193,7 +214,8 @@ AliMUONDigitizerV3::ApplyResponseToTrackerDigit(AliMUONVDigit& digit, Bool_t add
   }    
 
   Int_t adc = DecalibrateTrackerDigit(*pedestal,*gain,manuChannel,charge,addNoise,
-                                      digit.IsNoiseOnly());
+                                      digit.IsNoiseOnly(),
+                                      fRecoParam->GetCalibrationMode());
   
   digit.SetADC(adc);
 }
@@ -293,34 +315,51 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
                                             Int_t channel,
                                             Float_t charge,
                                             Bool_t addNoise,
-                                            Bool_t noiseOnly)
+                                            Bool_t noiseOnly,
+                                            const TString& calibrationMode)
 {
   /// Decalibrate (i.e. go from charge to adc) a tracker digit, given its
   /// pedestal and gain parameters.
   /// Must insure before calling that channel is valid (i.e. between 0 and
   /// pedestals or gains->GetSize()-1, but also corresponding to a valid channel
   /// otherwise results are not predictible...)
-
+  ///
+  /// This method is completely tied to what happens in its sister method :
+  /// AliMUONDigitCalibrator::CalibrateDigit, which is doing the reverse work...
+  ///
+  
   static const Int_t kMaxADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
   
+  Bool_t nogain = calibrationMode.Contains("NOGAIN");
+  
+  Float_t a1(0.0);
+  Int_t thres(4095);
+  Int_t qual(0xF);
+  Float_t capa(AliMUONConstants::DefaultCapa()); // capa = 0.2 and a0 = 1.25
+  Float_t a0(AliMUONConstants::DefaultA0());  // is equivalent to gain = 4 mV/fC
+  Float_t adc2mv(AliMUONConstants::DefaultADC2MV()); // 1 ADC channel = 0.61 mV
+               
+  if ( ! nogain )
+  {
+    a0 = gains.ValueAsFloat(channel,0);
+    a1 = gains.ValueAsFloat(channel,1);
+    thres = gains.ValueAsInt(channel,2);
+    qual = gains.ValueAsInt(channel,3);
+  }
+  
   Float_t pedestalMean = pedestals.ValueAsFloat(channel,0);
   Float_t pedestalSigma = pedestals.ValueAsFloat(channel,1);
   
   AliDebugClass(1,Form("DE %04d MANU %04d CH %02d PEDMEAN %7.2f PEDSIGMA %7.2f",
                       pedestals.ID0(),pedestals.ID1(),channel,pedestalMean,pedestalSigma));
   
-  Float_t a0 = gains.ValueAsFloat(channel,0);
-  Float_t a1 = gains.ValueAsFloat(channel,1);
-  Int_t thres = gains.ValueAsInt(channel,2);
-  Int_t qual = gains.ValueAsInt(channel,3);
-
   if ( qual <= 0 ) return 0;
   
   Float_t chargeThres = a0*thres;
   
   Float_t padc(0); // (adc - ped) value
   
-  if ( charge <= chargeThres || TMath::Abs(a1) < 1E-12 ) 
+  if ( nogain || charge <= chargeThres || TMath::Abs(a1) < 1E-12 ) 
   {
     // linear part only
     
@@ -331,6 +370,11 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
   }
   else 
   {
+    // FIXME: when we'll use capacitances and real gains, revise this part
+    // to take capa properly into account...
+    
+    AliWarningClass("YOU PROBABLY NEED TO REVISE THIS PART OF CODE !!!");
+    
     // linear + parabolic part
     Double_t qt = chargeThres - charge;
     Double_t delta = a0*a0-4*a1*qt;
@@ -371,6 +415,8 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
     }
   }
   
+  padc /= capa*adc2mv;
+  
   Int_t adc(0);
   
   Float_t adcNoise = 0.0;
@@ -907,3 +953,15 @@ AliMUONDigitizerV3::NoiseFunction()
   return f;
 }
 
+//_____________________________________________________________________________
+void AliMUONDigitizerV3::SetCalibrationData(AliMUONCalibrationData* calibrationData, 
+                                            AliMUONRecoParam* recoParam) 
+{
+  fCalibrationData = calibrationData;
+  fRecoParam = recoParam;
+  if (!fRecoParam)
+  {
+    AliError("Cannot work (e.g. decalibrate) without recoparams !");
+  }
+}
+
index 409608b5d8ebe0d108024d5a607abe1da021ca24..7f3d0829fad6cc4c42e22b7107a2d321c5209bf4 100644 (file)
@@ -29,6 +29,7 @@ class AliLoader;
 class AliMUONVTriggerStore;
 class AliMUONTriggerElectronics;
 class AliMUONVCalibParam;
+class AliMUONRecoParam;
 class AliMUONTriggerChamberEfficiency;
 class AliMUONTriggerUtilities;
 
@@ -49,11 +50,11 @@ public:
                                        Int_t channel,
                                        Float_t charge,
                                        Bool_t addNoise=kFALSE,
-                                       Bool_t noiseOnly=kFALSE);
+                                       Bool_t noiseOnly=kFALSE,
+                                       const TString& calibrationMode="NOGAIN");
   
-  /// Set calibration data
-  void SetCalibrationData(AliMUONCalibrationData* calibrationData) 
-                          {fCalibrationData = calibrationData;}
+  /// Set calibration (and recoparam) data
+  void SetCalibrationData(AliMUONCalibrationData* calibrationData, AliMUONRecoParam* recoParam);
 
   /// Set the number of sigmas for pedestal cut
   static void SetNSigmas(Double_t nsigmas=4.0) { fgNSigmas = nsigmas; }
@@ -102,11 +103,12 @@ private:
   AliMUONVDigitStore* fDigitStore; //!< temporary digits
   AliMUONVDigitStore* fOutputDigitStore; //!< digits we'll output to disk
   TObjArray* fInputDigitStores; //!< input digit stores (one per input file
+  AliMUONRecoParam* fRecoParam; //!< reco params (to know how to decalibrate) (not owner)
   AliMUONTriggerChamberEfficiency* fTriggerEfficiency; //!< trigger efficiency map
   AliMUONTriggerUtilities* fTriggerUtilities; //!< Trigger utilities for masks
   TArrayI fEfficiencyResponse; //!< Local board efficiency response
   
-  ClassDef(AliMUONDigitizerV3,10) // MUON Digitizer V3-9
+  ClassDef(AliMUONDigitizerV3,11) // MUON Digitizer V3-11
 };
 
 #endif
index d6c30fb8443a858176117ee5c34d4e1f37816859..031eede19c96e093018795d840e5092788c9dc7d 100644 (file)
@@ -57,6 +57,11 @@ public:
   /// Set the calibration status
   virtual void Calibrated(Bool_t value) { SetBit(kCalibrated,value); }
   
+  /// Whether this digit has its charge already in fC
+  virtual Bool_t IsChargeInFC() const { return TestBit(kChargeInFC); }
+  /// Set the charge unit value
+  virtual void ChargeInFC(Bool_t value=kTRUE) { SetBit(kChargeInFC,value); }
+
   /// Whether this digit is part of a cluster or something else
   virtual Bool_t IsUsed() const { return TestBit(kUsed); }
   /// Set the used status
@@ -89,10 +94,11 @@ private:
   {
     kSaturated = BIT(20),  ///< to indicate that manas amplifier has saturated 
     kUsed = BIT(21),       ///< whether the digit is used (e.g. in a cluster)
-    kCalibrated = BIT(22)  ///< whether the digit has been calibrated or not 
+    kCalibrated = BIT(22),  ///< whether the digit has been calibrated or not 
+    kChargeInFC = BIT(23)   ///< whether the digit has a charge in fC or not
   };
   
-  ClassDef(AliMUONRealDigit,1) // Implementation of AliMUONVDigit
+  ClassDef(AliMUONRealDigit,2) // Implementation of AliMUONVDigit
 };
 
 #endif
index 7ef3777efc975738845087cde3f8288c8966ea80..d30ac34af89456c98103feb370d39360aebb04de 100644 (file)
@@ -355,6 +355,8 @@ void AliMUONRecoParam::Print(Option_t *option) const
   
   if (IsDefault()) cout<<"\t\t*** Parameters used by default ***"<<endl;
   
+  cout << "Event Specie=" << GetEventSpecie() << endl;
+  
   cout<<Form("Calibration mode = %s",fCalibrationMode.Data())<<endl;
   cout<<Form("Clustering mode = %s",fClusteringMode.Data())<<endl;
   cout<<Form("Tracking mode = %s",fTrackingMode.Data())<<endl;
index 50688e16eaee57dd737c00e244dafe47fb345d28..7bdd6c12f5e887eed9ca7d9500f0b2197e9243db 100644 (file)
@@ -175,13 +175,12 @@ AliMUONReconstructor::~AliMUONReconstructor()
 
   AliDebug(1,"");
 
+  delete fDigitCalibrator;
+
   delete fDigitMaker;
   delete fDigitStore;
   delete fTransformer;
   delete fTriggerCircuit;
-  delete fDigitCalibrator;
-  delete fCalibrationData;
-  delete fClusterServer;
   delete fTriggerStore;
   delete fTrackStore;
   delete fClusterStore;
@@ -189,7 +188,9 @@ AliMUONReconstructor::~AliMUONReconstructor()
   delete fTriggerUtilities;
 
   delete AliMpSegmentation::Instance(false);
-  delete AliMpDDLStore::Instance(false);
+  delete AliMpDDLStore::Instance(false);  
+
+  delete fCalibrationData;
 }
 
 //_____________________________________________________________________________
@@ -533,9 +534,7 @@ AliMUONReconstructor::CreateCalibrator() const
     AliWarning("NOSTATUSMAP is obsolete");
   }
 
-  TString calibMode = GetRecoParam()->GetCalibrationMode();
-
-  fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam(),calibMode.Data());
+  fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,GetRecoParam());
 }
 
 //_____________________________________________________________________________
index 65b9ad5ef22b144483ff2c22addfbd2d187c172f..1f596e2b07769dc6cf6378eb80917dacc5ef413b 100644 (file)
@@ -271,6 +271,9 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t ti
     qtot = AliMUONConstants::ReducedQTot(qtot,timeDif);
   }
   
+  // Scale the charge to it'll (roughly) be in fC
+  qtot *= AliMUONConstants::DefaultADC2MV()*AliMUONConstants::DefaultA0()*AliMUONConstants::DefaultCapa();
+  
   // Get the charge correlation between cathodes.
   Float_t currentCorrel = TMath::Exp(gRandom->Gaus(0.0,ChargeCorrel()/2.0));
 
@@ -328,16 +331,19 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t ti
       Float_t qp = TMath::Abs(fMathieson->IntXY(lowerLeft.X(),lowerLeft.Y(),
                                                 upperRight.X(),upperRight.Y()));
             
-      Int_t icharge = Int_t(qp*qcath);
-      
-      if ( qp > fChargeThreshold )
+      if ( qp > fChargeThreshold && 
+           qp*qcath > AliMUONConstants::DefaultADC2MV()*AliMUONConstants::DefaultA0()*AliMUONConstants::DefaultCapa() )
       {
         // If we're above threshold, then we create a digit,
         // and fill it with relevant information, including electronics.
+        
+        // note that the second condition above is to be backward compatible (when 
+        // the sdigitizer was making a cut on Int_t(qp*qcath) > 0 and qcath was in ADC, not in fC)
+        
         AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetManuId(),
                                            pad.GetManuChannel(),cath);
         d->SetPadXY(pad.GetIx(),pad.GetIy());
-        d->SetCharge(icharge);
+        d->SetCharge(qp*qcath);
         digits.Add(d);   
       }       
       it->Next();
index 0960c203433dcb9f298ae7cc56205a182238173c..3b00f8784507a29675772d089aed5b17e414f754 100644 (file)
@@ -231,17 +231,15 @@ AliMUONSDigitizerV2::Exec(Option_t*)
     
     while ( ( d = static_cast<AliMUONVDigit*>(next()) ) )
     {
-      if ( d->Charge() > 0 ) // that check would be better in the disintegrate
-        // method, but to compare with old sdigitizer, it has to be there.
+      d->ChargeInFC(kTRUE);
+      
+      AliMUONVDigit* added = sDigitStore->Add(*d,AliMUONVDigitStore::kMerge);
+      if (!added)
       {
-        AliMUONVDigit* added = sDigitStore->Add(*d,AliMUONVDigitStore::kMerge);
-        if (!added)
-        {
-          AliError("Could not add digit to digitStore");
-        }
+        AliError("Could not add digit to digitStore");
       }
     }
-
+  
     treeS->Fill();
     
     loader->WriteSDigits("OVERWRITE");
index e640c033da3d631740d56437b894a7bab846deb1..92193f2dc5b829137cd32e7431def76fa363c717 100644 (file)
@@ -268,7 +268,7 @@ AliMUONTrackerDataMaker::Ctor(const AliMUONRecoParam* recoParam,
       AliCDBManager::Instance()->SetDefaultStorage(storage);
     }
     
-    fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam,calibMode);
+    fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam);
     //FIXME: get the reco param from GUI and/or from OCDB if not used from the QA code ?
   }
 }
index 8d8107e8a28c47cee6d6b10ed25dd5736373e94e..511e1986c043846163324af6cee3b66b2aafb91a 100644 (file)
 /// Also, if HasGeometryInformation is true, the digit knows the position and
 /// the (half) dimensions (in cm) of the pad it corresponds to.
 ///
+/// Note 1.
+///
+/// Please note that IsCalibrated and IsChargeInFC are two 
+/// concepts closely related, but not equivalent, at least for SDigits.
+///
+/// For instance a SDigit can have its charge in fC but not being calibrated.
+///
+/// { SDigits coming from a simulation are yet to be merged (i.e. the
+///   SDigitStore can contain several SDigits objects per channel), so, while
+///   their charge is in femto-coulomb, they are not calibrated (e.g. pedestal
+///   is not subtracted yet). }
+///
+/// Conversely, a calibrated (s)digit always has its charge in fC.
+///
 /// \author Laurent Aphecetche, Subatech
 //-----------------------------------------------------------------------------
 
@@ -210,12 +224,39 @@ void
 AliMUONVDigit::Print(Option_t* opt) const
 {
   /// Dump to screen.
+  ///
   /// If opt=="tracks", info on tracks are printed too.
+  /// 
+  /// The last part of the printout indicated the status of the digit :
+  /// (S) means that digit is saturated
+  /// (C) means that digit has been calibrated
+  /// [fC] means that digit's charge is in femto-coulombs (fC)
+  /// (U) means that digit is part of (has been used in) a cluster
+  /// (+) is noise-only digit (added by the simulation)
+  /// (X) has the IsConverted flag on (e.g. has been embedded)
+  
+  TString options(opt);
+  options.ToLower();
+
+  if ( options.Contains("zs") )
+  {
+    if ( IsCalibrated() && Charge() <= 0 )
+    {
+      return;
+    }
+    
+    if ( !IsCalibrated() && ADC() <= 0 )
+    {
+      return;
+    }
+  }
   
   cout << Form("<%s>: ID %12u DE %4d Cath %d (Ix,Iy)=(%3d,%3d) (Manu,Channel)=(%4d,%2d)"
                ", Charge=%7.2f",
                ClassName(),GetUniqueID(),
                DetElemId(),Cathode(),PadX(),PadY(),ManuId(),ManuChannel(),Charge());  
+  
+  
   if ( IsSaturated() ) 
   {
     cout << "(S)";
@@ -234,6 +275,15 @@ AliMUONVDigit::Print(Option_t* opt) const
     cout << "   ";
   }
 
+  if ( IsChargeInFC() )
+  {
+    cout << "[fC]";
+  }
+  else
+  {
+    cout << "    ";
+  }
+  
   if ( IsUsed() )
   {
     cout << "(U)";
@@ -243,10 +293,33 @@ AliMUONVDigit::Print(Option_t* opt) const
     cout << "   ";
   }
   
-  cout << Form(" ADC=%4d StatusMap=%04x",ADC(),StatusMap());
+  if ( IsNoiseOnly() )
+  {
+    cout << "(+)";
+  }
+  else
+  {
+    cout << "   ";
+  }
+  
+  if ( IsConverted() )
+  {
+    cout << "(X)";
+  }
+  else
+  {
+    cout << "   ";
+  }
+    
+  cout << Form(" ADC=%4d",ADC());
+  
+  if ( IsCalibrated() )
+  {
+    // StatusMap is not set before calibration has occured (e.g.
+    // SDigits cannot have it meaningfully filled)
+    cout << Form(" StatusMap=%04x",StatusMap());    
+  }
 
-  TString options(opt);
-  options.ToLower();
   if ( options.Contains("tracks") && HasMCInformation() )
   {
     cout << " Hit " << setw(3) << Hit();
index 86fb19859e7a002d90462eaad8d79264da3017e0..f77eafb812d8b0ef8db620523d955d30eee38565 100644 (file)
@@ -64,14 +64,16 @@ public:
   /// Set the efficiencyApplied status
   virtual void EfficiencyApplied(Bool_t /*value*/=kTRUE) {}
   
-  /// Whether this digit has been calibrated or not
+  /// Whether this digit has been calibrated or not (see note 1 in AliMUONVDigit.cxx)
   virtual Bool_t IsCalibrated() const=0;
-  /// Set the calibrated status
+  /// Set the calibrated status (see note 1 in AliMUONVDigit.cxx)
   virtual void Calibrated(Bool_t value)=0;
 
-  /// Whether this digit has charge in femto coulomb
+  /// Whether this digit has charge in femto coulomb (see note 1 in AliMUONVDigit.cxx)
   virtual Bool_t IsChargeInFC() const { return kFALSE; }
-  
+  /// Set the unit value (see note 1 in AliMUONVDigit.cxx)
+  virtual void ChargeInFC(Bool_t value=kTRUE)=0;
+
   /// Whether or not this digit was obtained from a conversion (e.g. real to simulated)
   virtual Bool_t IsConverted() const { return kFALSE; }
 
index 7d181d5a8f2318602cffbe3fffd953f57848719d..dad00e9f8af2abb29cfb1e1e2482ecad16ba53e8 100755 (executable)
@@ -22,17 +22,18 @@ CURDIR=`pwd`
 #RUN=0 # run number for OCDB access
 SEED=1234567 # random number generator seed
 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
-DUMPEVENT=5 # event to be dump on files
+DUMPEVENT=5 # event to be dump on files (set to negative to skip dumps)
 
 SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C"
 EMBEDWITH="" # no embedding by default
+REALISTIC=0 # ideal simulation by default
 
 # next try to see if there are options of this script that want to change the
 # defaults
  
 EXIT=0
 
-while getopts "SRZX:srxzn:tg:p:d:c:e:" option
+while getopts "SRZX:srxzn:tg:p:d:c:e:b:" option
 do
   case $option in
     R ) RECONSTRUCTION=1;;
@@ -53,6 +54,10 @@ do
     g ) SEED=$OPTARG;;
     p ) RECOPTIONS=$OPTARG;; 
     e ) EMBEDWITH=$OPTARG;;
+    b ) 
+    REALISTIC=$OPTARG
+    RAW=0
+    ;;
     *     ) echo "Unimplemented option chosen."
     EXIT=1
     ;;
@@ -84,6 +89,7 @@ if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
   echo "       -d full path to output directory (default $OUTDIR)"
   echo "       -c full path to configuration file for simulation (default $SIMCONFIG)"
   echo "       -e full path to a galice.root file relating to SDigits to be merged (embedding)"
+  echo "       -b runnumber (int) make a realistic simulation using runnumber as anchor (default 0=ideal simulation)"
   exit 4;
 fi
 
@@ -96,6 +102,9 @@ fi
 if [ -n "$EMBEDWITH" ]; then
   echo "Will embed simulation with $EMBEDWITH"
 fi
+if [ "$REALISTIC" -gt 0 ]; then
+  echo "Will use anchor run $REALISTIC"
+fi
 if [ "$RECONSTRUCTION" -eq 1 ]; then
 echo "Reconstruction options to be used : $RECOPTIONS"
 if [ "$RAW" -eq 0 ]; then
@@ -169,14 +178,17 @@ if [ "$SIMULATION" -eq 1 ]; then
 
   echo "Running simulation  ..."
 
-  aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\,\""$EMBEDWITH"\"\) > $OUTDIR/testSim.out 2>&1
+  aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\,\""$EMBEDWITH"\"\,$REALISTIC\) > $OUTDIR/testSim.out 2>&1
 
   mkdir $OUTDIR/$SIMDIR
 
   if [ "$RAW" -eq 1 ]; then
-    echo "Moving generated files to $SIMDIR"
-    mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
-    mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
+    if [ "$REALISTIC" -eq 0 ]; then # we can not move for realistic simulations as we need e.g. kinematics to propagate the simulated vertex to the reco.
+      echo "Moving generated files to $SIMDIR"
+      mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
+      mv $OUTDIR/MUON*.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
+      mv $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/$SIMDIR
+    fi
   else  
     echo "Copying generated files to $SIMDIR"
     cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
@@ -194,6 +206,9 @@ if [ "$SIMULATION" -eq 1 ]; then
   if [ "$MC" = "g4" ]; then
     cp $ALICE_ROOT/MUON/geometry/geometry.root $OUTDIR
   fi 
+  
+  cp $OUTDIR/geometry.root $OUTDIR/$SIMDIR/geometry.root
+  
 fi
 
 ###############################################################################
@@ -205,8 +220,14 @@ fi
 if [ "$RECONSTRUCTION" -eq 1 ]; then
 
   if [ "$RAW" -eq 1 ]; then
-    rm -f galice.root 
+    if [ "$REALISTIC" -eq 0 ]; then
+      rm -f galice.root
+    fi
   fi  
+
+  if [ "$REALISTIC" -ne 0 ]; then
+    rm -f geometry.root
+  fi
   
   rm -f AliESD*.root *QA*.root
   
@@ -214,19 +235,23 @@ if [ "$RECONSTRUCTION" -eq 1 ]; then
 
   cd $OUTDIR
   
-  BOOLEMBED=kFALSE
+  RAWOCDB=kFALSE
   
   if [ -n "$EMBEDWITH" ]; then
-    BOOLEMBED=kTRUE
+    RAWOCDB=kTRUE
+  fi
+  
+  if [ "$REALISTIC" -gt 0 ]; then
+    RAWOCDB=kTRUE
   fi
   
   if [ "$RAW" -eq 1 ]; then
   
-    aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out 2>&1
+    aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\",$RAWOCDB\) > $OUTDIR/testReco.out 2>&1
 
   else
 
-    aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out  2>&1
+    aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\",$RAWOCDB\) > $OUTDIR/testReco.out  2>&1
   
   fi
   
@@ -272,6 +297,8 @@ EOF
       fi
     fi
   fi
+  
+if [ "$DUMPEVENT" -ge 0 ]; then
 
   echo "Running dumps for selected event ($DUMPEVENT) ..."
 
@@ -306,6 +333,8 @@ EOF
   fi
 fi
 
+fi
+
 echo "Finished"  
 echo "... see results in $OUTDIR"
 
index 65e8e4150b856b5bbdd6dc986a1ebb863880f8ab..5abda7c44deda77ef18d8c0c08c4ab1a3f51dba5 100644 (file)
@@ -70,7 +70,8 @@
 void Config(const char* directory="", 
             const char* option="param", 
             const char* digitstore="AliMUONDigitStoreV2S",
-            bool forEmbedding=kFALSE)
+            bool forEmbedding=kFALSE,
+            bool forRealistic=kFALSE)
 {
   //=====================================================================
   // Config file for MUON test
@@ -99,7 +100,7 @@ void Config(const char* directory="",
     { gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
       return; }
   rl->SetCompressionLevel(2);
-  rl->SetNumberOfEventsPerFile(100);
+  rl->SetNumberOfEventsPerFile(10000);
   gAlice->SetRunLoader(rl);
   //=======================================================================
   // For having more debuging messages
@@ -176,7 +177,11 @@ void Config(const char* directory="",
     gener->SetCutOnChild(1);
     gener->SetChildPhiRange(0.,360.);
     gener->SetChildThetaRange(171.0,178.0);
-    gener->SetOrigin(0,0,0);          //vertex position    gener->SetSigma(0,0,0);           //Sigma in (X,Y,Z) (cm) on IP position
+    gener->SetOrigin(0,0,0);          //vertex position    gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
+    if (forRealistic)
+    {
+      gener->SetVertexSmear(kPerEvent);
+    }
     gener->SetForceDecay(kDiMuon);
     gener->SetTrackingFlag(1);
     gener->Init();
@@ -275,8 +280,11 @@ void Config(const char* directory="",
     MUON->SetDigitizerWithNoise(0);
                MUON->SetConvertTrigger(true);
     
-    new AliITSv11Hybrid("ITS","ITS v11Hybrid");
-    
+    new AliITSv11Hybrid("ITS","ITS v11Hybrid");    
+  }
+  else if (forRealistic)
+  {
+    new AliITSv11Hybrid("ITS","ITS v11Hybrid");        
   }
   
   // Use non-high performance raw data decoder 
index 565b0db566ea13fc11001e53e47376a943633a7e..6ed1bccf300d1bd477090f7cd2777afdfe975b6e 100644 (file)
@@ -67,7 +67,7 @@
 #endif
 
 Bool_t MUONefficiency(const char* filename = "generated/galice.root", const char* esdFileName = "AliESDs.root",
-                     const char* geoFilename = "geometry.root", const char* ocdbPath = "local://$ALICE_ROOT/OCDB",
+                     const char* geoFilename = "generated/geometry.root", const char* ocdbPath = "local://$ALICE_ROOT/OCDB",
                      Int_t ExtrapToVertex = -1, Int_t ResType = 553, Int_t FirstEvent = 0, Int_t LastEvent = 1000000 )
 { 
 /// \param ExtrapToVertex (default -1) 
index 891e1eb27a5d9485b3b1dc07f0bd60d2941a60cb..f586faf5ba1a8658b6a4ad25b84aef4de33c2ee7 100644 (file)
 //#include <TObjectTable.h>
 #endif
 
-void runReconstruction(int seed, const char* input, const char* recoptions, bool embedding)
+void runReconstruction(int seed, const char* input, const char* recoptions, bool rawocdb)
 { 
   AliCDBManager* man = AliCDBManager::Instance();
   
-  if ( embedding ) 
+  if ( rawocdb ) 
   {
-    cout << "**** WILL USE RAW OCDB AS WE'RE RECONSTRUCTING EMBEDDED DATA" << endl;
-    man->SetDefaultStorage("raw://");
-  }
+    cout << "**** WILL USE RAW OCDB" << endl;
+    man->SetDefaultStorage("raw://"); //alien://folder=/alice/data/2011/OCDB?cacheFold=/Users/laurent/OCDBcache");
+    man->SetSpecificStorage("ITS/Calib/RecoParam","alien://folder=/alice/cern.ch/user/p/ppillot/OCDB_PbPbSim");
+  } 
   else
   {
     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
 
     man->SetSpecificStorage("GRP/GRP/Data",
                             Form("local://%s",gSystem->pwd()));
+
   }
   
   gRandom->SetSeed(seed);
   
   AliReconstruction* MuonRec = new AliReconstruction("galice.root");
   MuonRec->SetInput(gSystem->ExpandPathName(input));
-  MuonRec->SetRunReconstruction("MUON");
+  MuonRec->SetRunReconstruction("MUON ITS");
   MuonRec->SetFillESD("HLT");
   MuonRec->SetOption("HLT", "libAliHLTMUON.so");
-  MuonRec->SetNumberOfEventsPerFile(1000);
+  MuonRec->SetNumberOfEventsPerFile(10000);
   MuonRec->SetOption("MUON",recoptions);
   MuonRec->SetRunQA("MUON:ALL");
   MuonRec->SetQAWriteExpert(AliQAv1::kMUON);
index c7bf1fecb17b6b09611adb7d88cc961b6376d412..829154bb0a9654d2d47a04a27080b482b2efdee6 100644 (file)
@@ -35,7 +35,8 @@
 void runSimulation(int seed, 
                    int nevents, 
                    const char* config,
-                   const char* embedwith)
+                   const char* embedwith,
+                   int runnumber)
 { 
 // Uncoment following lines to run simulation with local residual mis-alignment
 // (generated via MUONGenerateGeometryData.C macro)
@@ -76,10 +77,30 @@ void runSimulation(int seed,
     
     cout << "***** EMBEDDING MODE : USING RAW OCDB" << endl;
     AliCDBManager::Instance()->SetDefaultStorage("raw://");
-    AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Calib/Gains");
     AliCDBManager::Instance()->SetSpecificStorage("local://$ALICE_ROOT/OCDB","MUON/Align/Data");
     
   }
+  else if ( runnumber > 0 )
+  {
+    // simulation with anchor run
+
+    cout << "***** ANCHOR RUN MODE : USING RAW OCDB AS MUCH AS POSSIBLE" << endl;
+    cout << "*****                   AND TAKING VERTEX FROM OCDB IF AVAILABLE" << endl;
+  
+    // Last parameter of Config.C indicates we're doing realistic simulations, so we NEED
+    // the ITS in the geometry
+    gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE,kTRUE);");
+
+    AliCDBManager::Instance()->SetDefaultStorage("raw://");
+    // use something like : "alien://folder=/alice/data/2011/OCDB?cacheFold=/Users/laurent/OCDBcache" instead of "raw://"
+    // if getting slow/problematic accesses to OCDB...
+        
+    AliCDBManager::Instance()->SetSpecificStorage("MUON/Align/Data","alien://folder=/alice/cern.ch/user/j/jcastill/LHC10hMisAlignCDB");
+    
+    MuonSim.SetRunNumber(runnumber);
+    
+    MuonSim.UseVertexFromCDB();
+  }
   else
   {
     gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");    
@@ -89,9 +110,9 @@ void runSimulation(int seed,
   MuonSim.SetTriggerConfig("MUON");
   MuonSim.SetWriteRawData("MUON HLT","raw.root",kTRUE);
 
-  MuonSim.SetMakeDigits("MUON");
   MuonSim.SetMakeSDigits("MUON");
-  MuonSim.SetMakeDigitsFromHits("");
+  MuonSim.SetMakeDigits("MUON ITS"); // ITS needed to propagate the simulated vertex
+  MuonSim.SetMakeDigitsFromHits("ITS"); // ITS needed to propagate the simulated vertex
 
   MuonSim.SetRunHLT("libAliHLTMUON.so chains=dHLT-sim");