]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Some fixes and updates for the embedding :
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Dec 2010 13:52:28 +0000 (13:52 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Dec 2010 13:52:28 +0000 (13:52 +0000)
  - added a raw2sdigits.sh script to convert a (real) raw data file to SDigits file(s) suitable for embedding
  - added a "-e" option to the AlirootRun_MUONtest.sh test script for embedding real data into the test simulation
  - added an option to runSimulation.C and runReconstruction.C to allow embedding (in particular switch for which OCDB is used)
  - added an option to AliMUONDigitMaker::Raw2Digits to fill SDigits instead of Digits (otherwise the ADC value was filled instead of the required charge)
  - added an option to Config.C to indicate whether or not this will be used for embedding (in which case we switch OFF the noise generation, as the noise
  will naturally come from the real data embedded). Made it compilable to ease debugging (this required mods in rootlogon.C and loadlibs.C)
  - added the possibility to convert real digits into simulated ones in AliMUONDigitStoreV2S::AddConcreteDigit
  (the reverse, converting sim digit into real one, e.g. in AliMUONDigitStoreV2R::AddConcreteDigit, is still forbidden).
  - added a (Is)Converted method to AliMUON(V)Digit to keep track of the digits that were converted from another class

  - fixed AliMUON::Raw2SDigits in order to use the specified sdigit classname, and to fill the correct part (charge instead of ADC) of the digit
  - fixed AliMUONDigitizerV3 to allow merging of digit stores of different classes

(Laurent)

17 files changed:
MUON/AliMUON.cxx
MUON/AliMUONDigit.cxx
MUON/AliMUONDigit.h
MUON/AliMUONDigitMaker.cxx
MUON/AliMUONDigitMaker.h
MUON/AliMUONDigitStoreV2S.cxx
MUON/AliMUONDigitizerV3.cxx
MUON/AliMUONDigitizerV3.h
MUON/AliMUONVDigit.h
MUON/AlirootRun_MUONtest.sh
MUON/Config.C
MUON/MUONefficiency.C
MUON/loadlibs.C
MUON/raw2sdigits.sh [new file with mode: 0755]
MUON/rootlogon.C
MUON/runReconstruction.C
MUON/runSimulation.C

index 10a60f0054b1ef7861e066fc1cb7163ab04c05a9..5bce7dffdce4f5c54126d70f4a3bdd839e43b45a 100644 (file)
@@ -508,21 +508,23 @@ void AliMUON::Digits2Raw()
 //_____________________________________________________________________
 Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader)
 {
-/// Convert  raw data to SDigit
-
+  /// Convert  raw data to SDigit
+  
   if (!fLoader->TreeS()) fLoader->MakeSDigitsContainer();
-
+  
   TTree* treeS = fLoader->TreeS();
   
-  AliMUONVDigitStore* sDigitStore = new AliMUONDigitStoreV1;
+  AliMUONVDigitStore* sDigitStore = AliMUONVDigitStore::Create(DigitStoreClassName());
+  
   sDigitStore->Connect(*treeS);
   
-  fDigitMaker->Raw2Digits(rawReader,sDigitStore,0x0);
+  if (!fDigitMaker) fDigitMaker = new AliMUONDigitMaker;
+  fDigitMaker->Raw2Digits(rawReader,sDigitStore,0x0,kTRUE);
   treeS->Fill();
   fLoader->WriteSDigits("OVERWRITE");
-
+  
   fLoader->UnloadSDigits();
-
+  
   delete sDigitStore;
   
   return kTRUE;
index 793d3ade531b6d18017a5114c9f4412ae2cbc0c5..f8c5882ad6e43755c9b6fa9a006fe28f8cf36b37 100644 (file)
@@ -239,6 +239,15 @@ AliMUONDigit::IsCalibrated() const
   return (fFlags & fgkCalibratedMask );
 }
 
+//_____________________________________________________________________________
+Bool_t
+AliMUONDigit::IsConverted() const
+{
+  /// Whether this digit is converted or not
+  
+  return (fFlags & fgkConverted);
+}
+
 
 //_____________________________________________________________________________
 Bool_t
@@ -386,6 +395,22 @@ AliMUONDigit::Saturated(Bool_t value)
   }
 }
 
+//_____________________________________________________________________________
+void
+AliMUONDigit::Converted(Bool_t value)
+{
+  /// Set the convertion status of this digit.
+  
+  if ( value )
+  {
+    fFlags |= fgkConverted;
+  }
+  else
+  {
+    fFlags &= ~fgkConverted;
+  }
+}
+
 //_____________________________________________________________________________
 Int_t
 AliMUONDigit::Track(Int_t i) const
index f895d25bc8db28ff7ab4ed76a895c2d4d0748c08..b748c324ddf8717fa8fa341a26e86492ee0abba9 100644 (file)
@@ -52,12 +52,14 @@ class AliMUONDigit : public AliMUONVDigit
     virtual Bool_t IsSaturated() const;
     virtual Bool_t IsNoiseOnly() const;
     virtual Bool_t IsEfficiencyApplied() const;
+    virtual Bool_t IsConverted() const;
     virtual UInt_t StatusMap() const { return fStatusMap; }    ///< Return Neighbouring pad status
     
     virtual void NoiseOnly(Bool_t value=kTRUE);
     virtual void Saturated(Bool_t saturated=kTRUE);
     virtual void EfficiencyApplied(Bool_t value=kTRUE);
-    
+    virtual void Converted(Bool_t value=kTRUE);
+  
     virtual void SetADC(Int_t adc)         {fADC=adc; }        ///< Set ADC value
     virtual void SetPadXY(Int_t padx, Int_t pady)        {fPadX = padx; fPadY=pady; }      ///< Set pad number along x
     virtual void SetCharge(Float_t q)        {fSignal = q;}    ///< Set charge
@@ -116,8 +118,9 @@ private:
     static const UInt_t fgkCalibratedMask = 0x100; ///< whether this digits has been calibrated
     static const UInt_t fgkNoiseOnlyMask = 0x1000; ///< indicate a simulated digit due to noise only
     static const UInt_t fgkEfficiencyMask = 0x2000; ///< indicate chamber efficiency has been applied to a simulated digit
-    
-    ClassDef(AliMUONDigit,10)  //Digits for MUON
+    static const UInt_t fgkConverted       = 0x4000; ///< has been converted from a real digit
+  
+    ClassDef(AliMUONDigit,11)  //Digits for MUON
 };
 
 #endif
index 159b99bfd7daa420f43d0f0d1a49c96c7e042402..19806ac24e768f6268ff1fa5f11eeceef675a8c8 100644 (file)
@@ -173,8 +173,9 @@ AliMUONDigitMaker::Print(Option_t*) const
 //____________________________________________________________________
 Int_t
 AliMUONDigitMaker::Raw2Digits(AliRawReader* rawReader, 
-                                        AliMUONVDigitStore* digitStore,
-                                        AliMUONVTriggerStore* triggerStore)
+                              AliMUONVDigitStore* digitStore,
+                              AliMUONVTriggerStore* triggerStore,
+                              Bool_t sdigit)
 {
   /// Main method to creates digit
   /// for tracker 
@@ -198,7 +199,7 @@ AliMUONDigitMaker::Raw2Digits(AliRawReader* rawReader,
   if ( fDigitStore ) 
   {
     fDigitStore->Clear(); // insure we start with an empty container
-    tracker = ReadTrackerDDL(rawReader);
+    tracker = ReadTrackerDDL(rawReader,sdigit);
   }
   
   if ( fTriggerStore || fMakeTriggerDigits ) 
@@ -219,7 +220,7 @@ AliMUONDigitMaker::Raw2Digits(AliRawReader* rawReader,
 
 //____________________________________________________________________
 Int_t
-AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader)
+AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader, Bool_t sdigit)
 {
   /// Reading tracker DDL
   /// filling the fDigitStore container, which must not be null
@@ -289,8 +290,14 @@ AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader)
     
     digit->SetPadXY(pad.GetIx(),pad.GetIy());
     
-    digit->SetADC(charge);
-
+    if ( sdigit ) 
+    {
+      digit->SetCharge(charge);
+    }
+    else
+    {
+      digit->SetADC(charge);
+    }
   }
   
   if ( fRawStreamTracker->IsErrorMessage() ) 
index 0db611728328ff9ebcb088c8a6b59a9d3272faed..d3215899fdddf1fbea4534d5dab65e4af44bb9c9 100644 (file)
@@ -46,9 +46,10 @@ class AliMUONDigitMaker : public TObject
   // write raw data
   Int_t  Raw2Digits(AliRawReader* rawReader, 
                     AliMUONVDigitStore* digitContainer=0,
-                    AliMUONVTriggerStore* triggerStore=0);
+                    AliMUONVTriggerStore* triggerStore=0,
+                    Bool_t sdigit=kFALSE);
 
-  Int_t  ReadTrackerDDL(AliRawReader* rawReader);
+  Int_t  ReadTrackerDDL(AliRawReader* rawReader, Bool_t sdigit);
   Int_t  ReadTriggerDDL(AliRawReader* rawReader);
   
   Int_t TriggerDigits(Int_t nBoard, const TArrayS* xyPattern, 
index 3bdd6c66b4c09f6f50fa498a74d8de3782b2b2ac..c0368b28d79be84a95f2fb42174470f85b92be10 100644 (file)
@@ -53,12 +53,18 @@ AliMUONDigitStoreV2S::AddConcreteDigit(TClonesArray& a,
                                        const AliMUONVDigit& digit,
                                        Int_t index)
 {
-  /// add a digit to this store
-  const AliMUONDigit* d = dynamic_cast<const AliMUONDigit*>(&digit);
+  /// add a digit to this store  
   
-  if ( !d ) return 0x0;
-  
-  return new(a[index]) AliMUONDigit(*d);
+  if ( digit.IsA() != AliMUONDigit::Class() ) 
+  {
+    AliMUONDigit d(digit.DetElemId(),digit.ManuId(),digit.ManuChannel(),digit.Cathode());
+    d.SetCharge(digit.Charge());
+    d.SetADC(digit.ADC());
+    d.Converted();
+    return new(a[index]) AliMUONDigit(d);
+  }
+
+  return new(a[index]) AliMUONDigit(static_cast<const AliMUONDigit&>(digit));
 }
 
 //_____________________________________________________________________________
index 4c86d9657e21428d9b557643c4836f0d7c0ff8f4..548212871cd66d76694ba10138c7a594a84aa89f 100644 (file)
@@ -104,7 +104,7 @@ fLogger(new AliMUONLogger(1000)),
 fTriggerStore(new AliMUONTriggerStoreV1),
 fDigitStore(0x0),
 fOutputDigitStore(0x0),
-fInputDigitStore(0x0)
+fInputDigitStores(0x0)
 {
   /// Ctor.
 
@@ -125,7 +125,7 @@ AliMUONDigitizerV3::~AliMUONDigitizerV3()
   delete fTriggerStore;
   delete fDigitStore;
   delete fOutputDigitStore;
-  delete fInputDigitStore;
+  delete fInputDigitStores;
   
   AliInfo("Summary of messages");
   fLogger->Print();
@@ -338,12 +338,19 @@ AliMUONDigitizerV3::DecalibrateTrackerDigit(const AliMUONVCalibParam& pedestals,
 
 //_____________________________________________________________________________
 void
-AliMUONDigitizerV3::CreateInputDigitStore()
+AliMUONDigitizerV3::CreateInputDigitStores()
 {
-  /// Create an input digit store, and check that all input files
-  /// actually contains the same type of AliMUONVDigitStore
+  /// Create input digit stores
+  /// 
   
-  fInputDigitStore = 0x0;
+  if (fInputDigitStores)
+  {
+    AliFatal("Should be called only once !");
+  }
+  
+  fInputDigitStores = new TObjArray;
+  
+  fInputDigitStores->SetOwner(kTRUE);
   
   for ( Int_t iFile = 0; iFile < fManager->GetNinputs(); ++iFile )
   {    
@@ -357,19 +364,7 @@ AliMUONDigitizerV3::CreateInputDigitStore()
       AliFatal(Form("Could not get access to input file #%d",iFile));
     }
     
-    AliMUONVDigitStore* inputStore = AliMUONVDigitStore::Create(*iTreeS);
-    
-    if (!fInputDigitStore)
-    {
-      fInputDigitStore = inputStore;
-    }
-    else
-    {
-      if ( inputStore->IsA() != fInputDigitStore->IsA() )
-      {
-        AliFatal("Got different types of AliMUONVDigitStore here. Please implement me.");
-      }
-    }
+    fInputDigitStores->AddAt(AliMUONVDigitStore::Create(*iTreeS),iFile);
   }
 }
 
@@ -385,8 +380,6 @@ AliMUONDigitizerV3::Exec(Option_t*)
     
   AliCodeTimerAuto("",0)
   
-  AliDebug(1, "Running digitizer.");
-  
   if ( fManager->GetNinputs() == 0 )
   {
     AliWarning("No input set. Nothing to do.");
@@ -427,19 +420,22 @@ AliMUONDigitizerV3::Exec(Option_t*)
       AliFatal(Form("Could not get access to input file #%d",iFile));
     }
 
-    if (!fInputDigitStore)
+    if (!fInputDigitStores)
     {
-      CreateInputDigitStore();
+      CreateInputDigitStores();      
     }
-    fInputDigitStore->Connect(*iTreeS);
     
-    iTreeS->GetEvent(0);
+    AliMUONVDigitStore* dstore = static_cast<AliMUONVDigitStore*>(fInputDigitStores->At(iFile));
+    
+    dstore->Connect(*iTreeS);
     
-    MergeWithSDigits(fDigitStore,*fInputDigitStore,fManager->GetMask(iFile));
+    iTreeS->GetEvent(0);
+
+    MergeWithSDigits(fDigitStore,*dstore,fManager->GetMask(iFile));
 
     inputLoader->UnloadSDigits();
     
-    fInputDigitStore->Clear();
+    dstore->Clear();
   }
   
   // At this point, we do have digit arrays (one per chamber) which contains 
index ca1c6df955b0e25a2a0b3425f9b6318d72c7698b..5c8a9c9877d6ed5fe14fb39a9fbc30154f8998d9 100644 (file)
@@ -79,7 +79,7 @@ private:
   
   static TF1* NoiseFunction();
   
-  void CreateInputDigitStore();
+  void CreateInputDigitStores();
 
 private:
   Bool_t fIsInitialized; ///< are we initialized ?
@@ -93,9 +93,9 @@ private:
   AliMUONVTriggerStore* fTriggerStore; //!< trigger objects
   AliMUONVDigitStore* fDigitStore; //!< temporary digits
   AliMUONVDigitStore* fOutputDigitStore; //!< digits we'll output to disk
-  AliMUONVDigitStore* fInputDigitStore; //!< input digit store
+  TObjArray* fInputDigitStores; //!< input digit stores (one per input file
   
-  ClassDef(AliMUONDigitizerV3,9) // MUON Digitizer V3-9
+  ClassDef(AliMUONDigitizerV3,10) // MUON Digitizer V3-9
 };
 
 #endif
index 0bcbd934db0ee6eeebc3954e17bbd69cc8412d2e..b0d66e3e6ff00a6a1d8338a74df469a51b0db112 100644 (file)
@@ -69,6 +69,9 @@ public:
   /// Set the calibrated status
   virtual void Calibrated(Bool_t value)=0;
   
+  /// Whether or not this digit was obtained from a conversion (e.g. real to simulated)
+  virtual Bool_t IsConverted() const { return kFALSE; }
+
   /// Whether this digit is used somewhere (typically in a cluster)
   virtual Bool_t IsUsed() const = 0;
   /// Set the used status
index 6ececed2fd2eb921a09a88b7b89ef487e305581f..9aa2cc7ed63d16c47043a5671d3a3770e7b25c58 100755 (executable)
@@ -15,7 +15,7 @@ RECOPTIONS="SAVEDIGITS" # default reconstruction options
 MC=""    # G3 Simulation with old Config.C 
 #MC="g3"  # G3 Simulation (with new config macros)
 #MC="g4"  # G4 Simulation (with new config macros)
-SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C"   # default simulation configuration file
+
 OUTDIR=""
 CURDIR=`pwd`
 
@@ -24,12 +24,15 @@ 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
 
+SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C"
+EMBEDWITH="" # no embedding 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:" option
+while getopts "SRZX:srxzn:tg:p:d:c:e:" option
 do
   case $option in
     R ) RECONSTRUCTION=1;;
@@ -49,6 +52,7 @@ do
     n ) NEVENTS=$OPTARG;;
     g ) SEED=$OPTARG;;
     p ) RECOPTIONS=$OPTARG;; 
+    e ) EMBEDWITH=$OPTARG;;
     *     ) echo "Unimplemented option chosen."
     EXIT=1
     ;;
@@ -79,14 +83,19 @@ if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
   echo "       -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
   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)"
   exit 4;
 fi
 
+
 # printout the options
 echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
 if [ "$SIMULATION" -eq 1 ]; then
   echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
 fi
+if [ -n "$EMBEDWITH" ]; then
+  echo "Will embed simulation with $EMBEDWITH"
+fi
 if [ "$RECONSTRUCTION" -eq 1 ]; then
 echo "Reconstruction options to be used : $RECOPTIONS"
 if [ "$RAW" -eq 0 ]; then
@@ -142,7 +151,7 @@ if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
   echo "Updating GRP CTP config  ..."
 
   aliroot -b > $OUTDIR/updateCDBCTPConfig.out 2>&1 << EOF
-  .L UpdateCDBCTPConfig.C+
+  .L UpdateCDBCTPConfig.C++g
   UpdateCDBCTPConfig();
   .q
 EOF
@@ -160,7 +169,7 @@ if [ "$SIMULATION" -eq 1 ]; then
 
   echo "Running simulation  ..."
 
-  aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) > $OUTDIR/testSim.out 2>&1
+  aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\,\""$EMBEDWITH"\"\) > $OUTDIR/testSim.out 2>&1
 
   mkdir $OUTDIR/$SIMDIR
 
@@ -205,13 +214,19 @@ if [ "$RECONSTRUCTION" -eq 1 ]; then
 
   cd $OUTDIR
   
+  BOOLEMBED=kFALSE
+  
+  if [ -n "$EMBEDWITH" ]; then
+    BOOLEMBED=kTRUE
+  fi
+  
   if [ "$RAW" -eq 1 ]; then
   
-    aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) > $OUTDIR/testReco.out 2>&1
+    aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out 2>&1
 
   else
 
-    aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) > $OUTDIR/testReco.out  2>&1
+    aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out  2>&1
   
   fi
   
@@ -230,7 +245,7 @@ if [ "$CHECKS" -eq 1 ]; then
     echo "Running efficiency  ..."
 
     aliroot -b > $OUTDIR/testResults.out 2>&1 << EOF
-    .L MUONefficiency.C+
+    .L MUONefficiency.C++g
     // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
     MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
     .q
@@ -240,7 +255,7 @@ EOF
 
       echo "Running Trigger efficiency  ..."
       aliroot -b > $OUTDIR/testTriggerResults.out 2>&1 << EOF
-      .L MUONTriggerEfficiency.C+
+      .L MUONTriggerEfficiency.C++g
       MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
       .q
 EOF
@@ -250,7 +265,7 @@ EOF
         echo "Running check ..."
         aliroot -b > $OUTDIR/testCheck.out 2>&1 << EOF
         gSystem->Load("libMUONevaluation");
-        .L MUONCheck.C+
+        .L MUONCheck.C++g
         MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root"); 
         .q
 EOF
@@ -262,7 +277,7 @@ EOF
 
   if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
     aliroot -l -b  << EOF
-    AliCDBManager* man = AliCDBManager::Instance();
+    AliCDBManager* man = AliCDBManager::Instance();    
     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
     mcdSim.DumpKine($DUMPEVENT);       > $OUTDIR/dump.$DUMPEVENT.kine
index cbf3b22299a1c9966b7338098f0244f4504ce206..18f4a6fdc922b649e29a3f902acfcdad876cee93 100644 (file)
 /// Remember to define the directory and event generator option:
 ///
 /// gAlice->SetConfigFunction("Config('$HOME','box');");
+///
+/// Can be compiled by :
+/// .L Config.C+
+/// (depends on the correct rootlogon.C though...)
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "AliABSOv3.h"
+#include "AliBODY.h"
+#include "AliConfig.h"
+#include "AliDIPOv3.h"
+#include "AliDecayerPythia.h"
+#include "AliFRAMEv2.h"
+#include "AliGenBox.h"
+#include "AliGenFixed.h"
+#include "AliGenHijing.h"
+#include "AliGenMUONCocktail.h"
+#include "AliGenMUONlib.h"
+#include "AliGenParam.h"
+#include "AliGenScan.h"
+#include "AliHALLv3.h"
+#include "AliITSv11Hybrid.h"
+#include "AliMAG.h"
+#include "AliMagF.h"
+#include "AliMUONv1.h"
+#include "AliPIPEv3.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliSHILv3.h"
+#include <Riostream.h>
+#include <TDatime.h>
+#include <TGeant3TGeo.h>
+#include <TGeoGlobalMagField.h>
+#include <TPDGCode.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TVirtualMC.h>
+
+//#include "AliZDCv3.h"
+//#include "AliFMDv1.h"
+//#include "AliPMDv1.h"
+//#include "AliVZEROv7.h"
+
+#endif
 
-void Config(char directory[100]="", char option[6]="param", const char* digitstore="AliMUONDigitStoreV2S")
+void Config(const char* directory="", 
+            const char* option="param", 
+            const char* digitstore="AliMUONDigitStoreV2S",
+            bool forEmbedding=kFALSE)
 {
   //=====================================================================
   // Config file for MUON test
   //=====================================================================
   //  Libraries required by geant321
+  
   gSystem->Load("liblhapdf.so");      // Parton density functions
   gSystem->Load("libpythia6.so");     // Pythia
   gSystem->Load("libgeant321.so");
@@ -190,17 +238,17 @@ void Config(char directory[100]="", char option[6]="param", const char* digitsto
   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1, AliMagF::k5kG));
   //============================================================= 
   //=================== Alice BODY parameters =============================
-  AliBODY *BODY = new AliBODY("BODY","Alice envelop");
+  new AliBODY("BODY","Alice envelop");
   //=================== ABSO parameters ============================
-  AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
+  new AliABSOv3("ABSO", "Muon Absorber");
   //=================== DIPO parameters ============================
-  AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
+  new AliDIPOv3("DIPO", "Dipole version 2");
   //================== HALL parameters ============================
-  AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
+  new AliHALLv3("HALL", "Alice Hall");
   //=================== PIPE parameters ============================
-  AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
+  new AliPIPEv3("PIPE", "Beam Pipe");
   //=================== SHIL parameters ============================
-  AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 2");
+  new AliSHILv3("SHIL", "Shielding Version 2");
 
   //=================== MUON Subsystem ===========================
   AliMUON *MUON = new AliMUONv1("MUON", "default");
@@ -219,12 +267,17 @@ void Config(char directory[100]="", char option[6]="param", const char* digitsto
 
   // Use SetDigitStoreClassName() to change the digitStore implementation used by (s)digitizer
   MUON->SetDigitStoreClassName(digitstore);
-  
-  cout << "MUON DigitStore is " << MUON->DigitStoreClassName().Data() << endl;
-  
-  // Noise-only digits in tracker/trigger (0=no noise, 1=default (noise in tracker), 2=noise in tracker and trigger):
-  //MUON->SetDigitizerWithNoise(kFALSE);
 
+  if ( forEmbedding ) 
+  {
+    // Noise-only digits in tracker/trigger (0=no noise, 1=default (noise in tracker), 2=noise in tracker and trigger):
+    cout << "****** DISABLING NOISE GENERATION AS WE DO EMBEDDING ******" << endl;
+    MUON->SetDigitizerWithNoise(0);
+    
+    new AliITSv11Hybrid("ITS","ITS v11Hybrid");
+    
+  }
+  
   // Use non-high performance raw data decoder 
   //MUON->SetFastTrackerDecoder(kFALSE);  
   //MUON->SetFastTriggerDecoder(kFALSE);  
index 1e7313d4d8c57475862e140a5d81da2b6ae3100c..565b0db566ea13fc11001e53e47376a943633a7e 100644 (file)
@@ -66,8 +66,8 @@
 
 #endif
 
-Bool_t MUONefficiency(char* filename = "generated/galice.root", char* esdFileName = "AliESDs.root",
-                     char* geoFilename = "geometry.root", char* ocdbPath = "local://$ALICE_ROOT/OCDB",
+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",
                      Int_t ExtrapToVertex = -1, Int_t ResType = 553, Int_t FirstEvent = 0, Int_t LastEvent = 1000000 )
 { 
 /// \param ExtrapToVertex (default -1) 
index e8a2532270196b2a0d0f554fab2d4ed905c4ab13..101c9c2f68d0e6ebd57a024a607572d824d286d2 100644 (file)
@@ -66,4 +66,14 @@ void loadlibs ()
   gSystem->Load("libMUONcalign");
   
   gSystem->Load("libMUONgraphics");
+
+  gSystem->Load("libEVGEN");
+  gSystem->Load("libgeant321");
+  gSystem->Load("libhijing");
+  gSystem->Load("libFASTSIM");
+  gSystem->Load("libThijing");
+  gSystem->Load("libEGPythia6");
+  gSystem->Load("libPythia6");
+  gSystem->Load("libAliPythia6");
+  
 }
diff --git a/MUON/raw2sdigits.sh b/MUON/raw2sdigits.sh
new file mode 100755 (executable)
index 0000000..651a532
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# raw2sdigits.sh rawfile [esdfile]
+#
+# convert a (real) raw data file into SDigits suitable for embedding.
+# if esdfile is present (should correspond to the raw data file ;-) )
+# then zvertex is taken from it
+
+rawfile=$1
+esdfile=""
+
+if [ $# -ge 2 ]; then
+ esdfile=$2
+fi
+
+echo "rawfile=$rawfile esdfile=$esdfile"
+
+aliroot -l -b << EOF
+
+    AliSimulation sim("$ALICE_ROOT/MUON/Config.C");
+    gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2R\",kTRUE);");
+    AliCDBManager *cdbm = AliCDBManager::Instance();
+    AliRawReader* reader = AliRawReader::Create(gSystem->ExpandPathName("$rawfile"));
+    reader->NextEvent();
+    Int_t runNumber = reader->GetRunNumber();
+    delete reader;
+    cout << "SETTING RUN NUMBER TO " << runNumber << endl;
+    cdbm->SetRun(runNumber);
+    cdbm->SetDefaultStorage("local://$ALICE_ROOT/OCDB");     
+    cdbm->SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd()));
+    sim.SetMakeSDigits("MUON");  
+
+    sim.ConvertRaw2SDigits("$rawfile","$esdfile");
+
+EOF
index 7ad52712d5544a72e9d9fc2cfd1d4fedccef8db9..f9c13f84c9874432548f4efd934965c249d8015e 100644 (file)
   includePath        += "-I${ALICE_ROOT}/MUON ";
   includePath        += "-I${ALICE_ROOT}/MUON/mapping ";
   includePath        += "-I${ALICE_ROOT}/RAW ";
-  includePath        += "-I${ALICE_ROOT}/include";
+  includePath        += "-I${ALICE_ROOT}/include ";
+  includePath        += "-I${ALICE_ROOT}/STRUCT ";
+  includePath        += "-I${GEANT3}/TGeant3 ";
+  includePath        += "-I${ALICE_ROOT}/THijing ";
+
   gSystem->SetIncludePath(includePath.Data());
 }
index 5f497e2235b78f57bb7719d8b725191b3aa9f343..8331f153fea241b668f8c5ac42391a94e70b40b5 100644 (file)
 //#include <TObjectTable.h>
 #endif
 
-void runReconstruction(int seed, const char* input, const char* recoptions)
+void runReconstruction(int seed, const char* input, const char* recoptions, bool embedding)
 { 
   AliCDBManager* man = AliCDBManager::Instance();
-  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-  man->SetSpecificStorage("GRP/GRP/Data",
-                         Form("local://%s",gSystem->pwd()));
+  
+  if ( embedding ) 
+  {
+    cout << "**** WILL USE RAW OCDB AS WE'RE RECONSTRUCTING EMBEDDED DATA" << endl;
+    man->SetDefaultStorage("raw://");
+  }
+  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(input);
-  MuonRec->SetRunVertexFinder(kFALSE);
-  MuonRec->SetRunLocalReconstruction("MUON");
-  MuonRec->SetRunTracking("MUON");
+  MuonRec->SetInput(gSystem->ExpandPathName(input));
+  MuonRec->SetRunReconstruction("MUON");
   MuonRec->SetFillESD("HLT");
   MuonRec->SetOption("HLT", "libAliHLTMUON.so");
-  MuonRec->SetLoadAlignData("MUON");
   MuonRec->SetNumberOfEventsPerFile(1000);
   MuonRec->SetOption("MUON",recoptions);
   MuonRec->SetRunQA("MUON:ALL");
   MuonRec->SetQAWriteExpert(AliQAv1::kMUON);
+  MuonRec->SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
+  MuonRec->SetWriteESDfriend(kFALSE);
+  MuonRec->SetCleanESD(kFALSE);  
+  MuonRec->SetStopOnError(kFALSE);
+  
   // uncomment the following lines if you want to set custom RecoParam
   // instead of getting them from the OCDB
   //  AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
index 04569908749053ddb624245b7f24ad0cd0b42dd2..db8ecd9129fcd382abdffb1e07f775f3329c7ab1 100644 (file)
 #include <TRandom.h>
 #endif
 
-void runSimulation(int seed, int nevents, const char* config)
+void runSimulation(int seed, 
+                   int nevents, 
+                   const char* config,
+                   const char* embedwith)
 { 
 // Uncoment following lines to run simulation with local residual mis-alignment
 // (generated via MUONGenerateGeometryData.C macro)
@@ -38,6 +41,47 @@ void runSimulation(int seed, int nevents, const char* config)
 // man->SetSpecificStorage("MUON/Align/Data","local://$ALICE_ROOT/OCDB/MUON/ResMisAlignCDB");
 
   AliSimulation MuonSim(config);
+  
+  if ( strlen(embedwith) > 0 )
+  {
+    // setups specific to embedding
+    
+    gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kTRUE);");
+    
+    // get the run number from real data
+    
+    AliRunLoader* runLoader = AliRunLoader::Open(embedwith,"titi");
+    if (runLoader == 0x0) 
+    {
+      AliError(Form("Cannot open file %s",filename));    
+      return;
+    }
+    
+    runLoader->LoadHeader();
+    
+    if ( ! runLoader->GetHeader() ) {
+      AliError("Cannot load header.");    
+      return;
+    }
+    else {
+      Int_t runNumber = runLoader->GetHeader()->GetRun();
+      MuonSim.SetRunNumber(runNumber);
+      cout << Form("***** RUN NUMBER SET TO %09d ACCORDING TO %s ",runNumber,embedwith) << endl;
+    }  
+    runLoader->UnloadHeader(); 
+    delete runLoader;
+    
+    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
+  {
+    gAlice->SetConfigFunction("Config(\"\", \"param\", \"AliMUONDigitStoreV2S\",kFALSE);");    
+  }
+  
   MuonSim.SetSeed(seed);
   MuonSim.SetTriggerConfig("MUON");
   MuonSim.SetWriteRawData("MUON HLT","raw.root",kTRUE);
@@ -50,6 +94,11 @@ void runSimulation(int seed, int nevents, const char* config)
 
   MuonSim.SetRunQA("MUON:ALL");
   
+  if ( strlen(embedwith) > 0 ) 
+  {
+    MuonSim.MergeWith(embedwith);
+  }
+  
   MuonSim.Run(nevents);
   //gObjectTable->Print();