/* $Id$ */
//-----------------------------------------------------------------------------
-/// \class AliMUONCDB
+/// \namespace AliMUONCDB
///
-/// Helper class to experience the OCDB
-/// It allows to generate dummy (but complete) containers for all the
+/// Helper functions to experience the OCDB
+///
+/// They allow to read magnetic field, mapping and recoParam from OCDB
+///
+/// And also to generate dummy (but complete) containers for all the
/// calibration data types we have for tracker and trigger, and to write
/// them into OCDB.
///
-/// For more information, please see READMECDB
+/// For more information, please see READMEcalib
///
// \author Laurent Aphecetche
//-----------------------------------------------------------------------------
#include "AliMUONVCalibParam.h"
#include "AliMUONGlobalCrateConfig.h"
#include "AliMUONRegionalTriggerConfig.h"
+#include "AliMUONRecoParam.h"
#include "AliMpCDB.h"
#include "AliMpConstants.h"
+#include "AliMpDEStore.h"
#include "AliMpDDLStore.h"
#include "AliMpManuStore.h"
#include "AliMpDEManager.h"
#include "AliCodeTimer.h"
#include "AliCDBEntry.h"
#include "AliCDBManager.h"
+#include "AliGRPManager.h"
#include "AliDCSValue.h"
#include "AliLog.h"
#include <TStopwatch.h>
#include <TSystem.h>
#include <TMath.h>
+#include <TGeoGlobalMagField.h>
-/// \cond CLASSIMP
-ClassImp(AliMUONCDB)
-/// \endcond
-
namespace
{
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-AliMUONCDB::AliMUONCDB(const char* cdbpath)
-: TObject(),
- fCDBPath(cdbpath),
- fMaxNofChannelsToGenerate(-1)
+Bool_t AliMUONCDB::CheckOCDB(Bool_t pathOnly)
{
- /// ctor
- // Load mapping
- if ( ! AliMpCDB::LoadDDLStore() ) {
- AliFatal("Could not access mapping from OCDB !");
- }
+ /// Check that OCDB path and run number are properly set
+
+ AliCDBManager* man = AliCDBManager::Instance();
+
+ // first OCDB path
+ if (!man->IsDefaultStorageSet()) {
+ AliErrorGeneral("AliMUONCDB", "OCDB path must be properly set");
+ return kFALSE;
+ }
+
+ // then run number if required
+ if (pathOnly) return kTRUE;
+ if (man->GetRun() < 0) {
+ AliErrorGeneral("AliMUONCDB", "Run number must be properly set");
+ return kFALSE;
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliMUONCDB::CheckMapping(Bool_t segmentationOnly)
+{
+ /// Check that the mapping has been loaded
+
+ // first the segmentation
+ if (!AliMpSegmentation::Instance(false)) {
+ AliErrorGeneral("AliMUONCDB", "Mapping segmentation must be loaded first");
+ return kFALSE;
+ }
+
+ // then the others if required
+ if (segmentationOnly) return kTRUE;
+ if (!AliMpDDLStore::Instance(false) || !AliMpDEStore::Instance(false) || !AliMpManuStore::Instance(false)) {
+ AliErrorGeneral("AliMUONCDB", "Full mapping must be loaded first");
+ return kFALSE;
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliMUONCDB::LoadField()
+{
+ /// Load magnetic field (existing field will be deleted).
+ /// OCDB path and run number are supposed to be set.
+
+ AliInfoGeneral("AliMUONCDB","Loading field map from GRP...");
+
+ if (!AliMUONCDB::CheckOCDB()) return kFALSE;
+
+ AliGRPManager grpMan;
+
+ // make sure the old field is deleted even if it is locked
+ if(TGeoGlobalMagField::Instance()->IsLocked()) delete TGeoGlobalMagField::Instance();
+
+ if (!grpMan.ReadGRPEntry() || !grpMan.SetMagField()) {
+ AliErrorGeneral("AliMUONCDB", "failed to load magnetic field from OCDB");
+ return kFALSE;
+ }
+
+ return kTRUE;
+
+}
- if ( ! AliMpCDB::LoadManuStore() ) {
- AliFatal("Could not access run-dependent mapping from OCDB !");
+//_____________________________________________________________________________
+Bool_t AliMUONCDB::LoadMapping(Bool_t segmentationOnly)
+{
+ /// Load mapping (existing mapping will be unloaded).
+ /// OCDB path and run number are supposed to be set.
+
+ AliInfoGeneral("AliMUONCDB", "Loading mapping from OCDB...");
+
+ if (!AliMUONCDB::CheckOCDB()) return kFALSE;
+
+ // in case it has already been set
+ AliMpCDB::UnloadAll();
+
+ if (segmentationOnly) {
+
+ if (!AliMpCDB::LoadMpSegmentation(kTRUE)){
+ AliErrorGeneral("AliMUONCDB", "failed to load segmentation from OCDB");
+ return kFALSE;
+ }
+
+ } else {
+
+ if (!AliMpCDB::LoadAll(kTRUE)) {
+ AliErrorGeneral("AliMUONCDB", "failed to load mapping from OCDB");
+ return kFALSE;
}
+
+ }
+
+ return kTRUE;
+
}
//_____________________________________________________________________________
-AliMUONCDB::~AliMUONCDB()
+AliMUONRecoParam* AliMUONCDB::LoadRecoParam()
{
- /// dtor
+ /// Load and return reconstruction parameters.
+ /// OCDB path is supposed to be set.
+
+ AliInfoGeneral("AliMUONCDB", "Loading RecoParam from OCDB...");
+
+ if (!AliMUONCDB::CheckOCDB()) return kFALSE;
+
+ 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->IsDefault()) break;
+ recoParam = 0x0;
+ }
+
+ }
+
+ }
+
+ if (!recoParam) AliErrorGeneral("AliMUONCDB", "failed to load RecoParam from OCDB");
+
+ return recoParam;
+
}
//_____________________________________________________________________________
if ( !sopt.Contains("ABS") && !sopt.Contains("REL") && !sopt.Contains("PERCENT") )
{
- AliErrorClass(Form("opt %s not supported. Only ABS, REL, PERCENT are",opt));
+ AliErrorGeneral("AliMUONCDB", Form("opt %s not supported. Only ABS, REL, PERCENT are",opt));
return 0x0;
}
/// contained inside store.
/// It produces histograms named name_0, name_1, etc...
+ if (!AliMUONCDB::CheckMapping(kTRUE)) return;
+
TIter next(store.CreateIterator());
AliMUONVCalibParam* param;
Int_t n(0);
{
h[i] = new TH1F(Form("%s_%d",name,i),Form("%s_%d",name,i),
nbins,xmin[i],xmax[i]);
- AliInfo(Form("Created histogram %s",h[i]->GetName()));
+ AliInfoGeneral("AliMUONCDB", Form("Created histogram %s",h[i]->GetName()));
}
}
for ( Int_t i = 0; i < kNStations; ++i )
{
- AliInfo(Form("Station %d %d ",(i+1),nPerStation[i]));
+ AliInfoGeneral("AliMUONCDB", Form("Station %d %d ",(i+1),nPerStation[i]));
}
- AliInfo(Form("Number of channels = %d",n));
+ AliInfoGeneral("AliMUONCDB", Form("Number of channels = %d",n));
delete[] nPerStation;
}
{
/// Create a HV store
+ if (!AliMUONCDB::CheckMapping()) return 0;
+
AliMpDCSNamer hvNamer("TRACKER");
TObjArray* aliases = hvNamer.GenerateAliases();
delete aliases;
- AliInfo(Form("%d HV channels and %d switches",nChannels,nSwitch));
+ AliInfoGeneral("AliMUONCDB", Form("%d HV channels and %d switches",nChannels,nSwitch));
return nChannels+nSwitch;
}
{
/// Create a Trigger HV and Currents store
+ if (!AliMUONCDB::CheckMapping()) return 0;
+
AliMpDCSNamer triggerDCSNamer("TRIGGER");
TObjArray* aliases = triggerDCSNamer.GenerateAliases();
delete aliases;
- AliInfo(Form("Trigger channels I -> %i HV -> %i",nChannels[0], nChannels[1]));
+ AliInfoGeneral("AliMUONCDB", Form("Trigger channels I -> %i HV -> %i",nChannels[0], nChannels[1]));
return nChannels[0] + nChannels[1];
}
/// otherwise mean and sigma are from a gaussian (with parameters
/// defined below by the kPedestal* constants)
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
+
+ if (!AliMUONCDB::CheckMapping()) return 0;
Int_t nchannels(0);
Int_t nmanus(0);
Bool_t ok = pedestalStore.Add(ped);
if (!ok)
{
- AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
+ AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
}
- if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break;
}
- AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels));
+ AliInfoGeneral("AliMUONCDB", Form("%d Manus and %d channels.",nmanus,nchannels));
return nchannels;
}
{
/// Create a reject list
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
AliMUONRejectList* rl = new AliMUONRejectList;
{
/// Create an occupancy map.
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
+
+ if (!AliMUONCDB::CheckMapping()) return 0;
Int_t nmanus(0);
Int_t numberOfChannelsInManu = de->NofChannelsInManu(manuId);
- if (!defaultValues) occ = gRandom->Rndm(1.0);
+ if (!defaultValues) occ = gRandom->Rndm(1);
Double_t sumn = occ*nevents;
Bool_t ok = occupancyMapStore.Add(occupancy);
if (!ok)
{
- AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
+ AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
}
}
{
/// Read the capacitance values from file and append them to the capaStore
+ if (!AliMUONCDB::CheckMapping()) return 0;
+
return AliMUONTrackerIO::ReadCapacitances(file,capaStore);
}
/// otherwise they are from a gaussian with parameters defined in the
/// kCapa* constants below.
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
+
+ if (!AliMUONCDB::CheckMapping()) return 0;
Int_t nchannels(0);
Int_t nmanus(0);
Bool_t ok = capaStore.Add(capa);
if (!ok)
{
- AliError(Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId));
+ AliErrorGeneral("AliMUONCDB", Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId));
}
}
Float_t percent = 0;
if ( nmanus ) percent = 100*nmanusOK/nmanus;
- AliInfo(Form("%5d manus with serial number (out of %5d manus = %3.0f%%)",
+ AliInfoGeneral("AliMUONCDB", Form("%5d manus with serial number (out of %5d manus = %3.0f%%)",
nmanusOK,nmanus,percent));
- AliInfo(Form("%5d channels",nchannels));
+ AliInfoGeneral("AliMUONCDB", Form("%5d channels",nchannels));
if ( percent < 100 )
{
- AliWarning("Did not get all serial numbers. capaStore is incomplete !!!!");
+ AliWarningGeneral("AliMUONCDB", "Did not get all serial numbers. capaStore is incomplete !!!!");
}
return nchannels;
/// otherwise parameters are taken from gaussians with parameters
/// defined in the k* constants below.
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
+
+ if (!AliMUONCDB::CheckMapping()) return 0;
Int_t nchannels(0);
Int_t nmanus(0);
Bool_t ok = gainStore.Add(gain);
if (!ok)
{
- AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
+ AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
}
- if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break;
}
- AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels));
+ AliInfoGeneral("AliMUONCDB", Form("%d Manus and %d channels.",nmanus,nchannels));
return nchannels;
}
//_____________________________________________________________________________
Int_t
-AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const
+AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks)
{
/// Generate local trigger masks store. All masks are set to FFFF
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
Int_t ngenerated(0);
// Generate fake mask values for all localboards and put that into
//_____________________________________________________________________________
Int_t
-AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) const
+AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm)
{
/// Make a regional trigger config store. Mask is set to FFFF for each local board (Ch.F.)
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
if ( ! rtm.ReadData(AliMpFiles::LocalTriggerBoardMapping()) ) {
- AliErrorStream() << "Error when reading from mapping file" << endl;
+ AliErrorGeneral("AliMUONCDB", "Error when reading from mapping file");
return 0;
}
//_____________________________________________________________________________
Int_t
-AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) const
+AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm)
{
/// Make a global trigger config store. All masks (disable) set to 0x00 for each Darc board (Ch.F.)
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
return gtm.ReadData(AliMpFiles::GlobalTriggerBoardMapping());
}
//_____________________________________________________________________________
AliMUONTriggerLut*
-AliMUONCDB::MakeTriggerLUT(const char* file) const
+AliMUONCDB::MakeTriggerLUT(const char* file)
{
/// Make a triggerlut object, from a file.
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
AliMUONTriggerLut* lut = new AliMUONTriggerLut;
lut->ReadFromFile(file);
//_____________________________________________________________________________
AliMUONTriggerEfficiencyCells*
-AliMUONCDB::MakeTriggerEfficiency(const char* file) const
+AliMUONCDB::MakeTriggerEfficiency(const char* file)
{
/// Make a trigger efficiency object from a file.
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
return new AliMUONTriggerEfficiencyCells(file);
}
{
/// Write a given object to OCDB
+ if (!AliMUONCDB::CheckOCDB(kTRUE)) return;
+
AliCDBId id(calibpath,startRun,endRun);
AliCDBMetaData md;
md.SetAliRootVersion(gROOT->GetVersion());
md.SetComment(comment);
md.SetResponsible(responsible);
- AliCDBManager* man = AliCDBManager::Instance();
- if (!man->IsDefaultStorageSet()) man->SetDefaultStorage(fCDBPath);
- man->Put(object,id,&md);
+ AliCDBManager::Instance()->Put(object,id,&md);
}
//_____________________________________________________________________________
/// Fill the neighbours store with, for each channel, a TObjArray of its
/// neighbouring pads (including itself)
- AliCodeTimerAuto("",0);
+ AliCodeTimerAutoGeneral("",0);
+
+ if (!AliMUONCDB::CheckMapping()) return 0;
- AliInfo("Generating NeighbourStore. This will take a while. Please be patient.");
+ AliInfoGeneral("AliMUONCDB", "Generating NeighbourStore. This will take a while. Please be patient.");
Int_t nchannels(0);
Bool_t ok = neighbourStore.Add(calibParam);
if (!ok)
{
- AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
+ AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
return -1;
}
}
return nchannels;
}
-//_____________________________________________________________________________
-void
-AliMUONCDB::SetMaxNofChannelsToGenerate(Int_t n)
-{
- /// Set the maximum number of channels to generate (used for testing only)
- /// n < 0 means no limit
- fMaxNofChannelsToGenerate = n;
-}
-
//_____________________________________________________________________________
void
AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun)
AliMUONVStore* ltm = new AliMUON1DArray(AliMpConstants::TotalNofLocalBoards()+1);
Int_t ngenerated = MakeLocalTriggerMaskStore(*ltm);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/LocalTriggerBoardMasks",ltm,startRun,endRun,true);
AliMUONRegionalTriggerConfig* rtm = new AliMUONRegionalTriggerConfig();
Int_t ngenerated = MakeRegionalTriggerConfigStore(*rtm);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/RegionalTriggerConfig",rtm,startRun,endRun,true);
AliMUONGlobalCrateConfig* gtm = new AliMUONGlobalCrateConfig();
Int_t ngenerated = MakeGlobalTriggerConfigStore(*gtm);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/GlobalTriggerCrateConfig",gtm,startRun,endRun,true);
AliMUONVStore* neighbours = Create2DMap();
Int_t ngenerated = MakeNeighbourStore(*neighbours);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/Neighbours",neighbours,startRun,endRun,true);
TMap* hvStore = new TMap;
Int_t ngenerated = MakeHVStore(*hvStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/HV",hvStore,startRun,endRun,defaultValues);
TMap* triggerDCSStore = new TMap;
Int_t ngenerated = MakeTriggerDCSStore(*triggerDCSStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if (ngenerated>0)
{
WriteToCDB("MUON/Calib/TriggerDCS",triggerDCSStore,startRun,endRun,defaultValues);
AliMUONVStore* pedestalStore = Create2DMap();
Int_t ngenerated = MakePedestalStore(*pedestalStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
WriteToCDB("MUON/Calib/Pedestals",pedestalStore,startRun,endRun,defaultValues);
delete pedestalStore;
}
AliMUONVStore* occupancyMapStore = Create2DMap();
Int_t ngenerated = MakeOccupancyMapStore(*occupancyMapStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
WriteToCDB("MUON/Calib/OccupancyMap",occupancyMapStore,startRun,endRun,defaultValues);
delete occupancyMapStore;
}
AliMUONVStore* gainStore = Create2DMap();
Int_t ngenerated = MakeGainStore(*gainStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
WriteToCDB("MUON/Calib/Gains",gainStore,startRun,endRun,defaultValues);
delete gainStore;
}
AliMUONVStore* capaStore = new AliMUON1DMap(16828);
Int_t ngenerated = MakeCapacitanceStore(*capaStore,filename);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
if ( ngenerated > 0 )
{
WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,filename);
AliMUONVStore* capaStore = new AliMUON1DMap(16828);
Int_t ngenerated = MakeCapacitanceStore(*capaStore,defaultValues);
- AliInfo(Form("Ngenerated = %d",ngenerated));
+ AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues);
delete capaStore;
}
/* $Id$ */
-/// \ingroup base
-/// \class AliMUONCDB
-/// \brief Helper class to experience the OCDB
+/// \ingroup rec
+/// \namespace AliMUONCDB
+/// \brief Helper functions to experience the OCDB
///
// Author Laurent Aphecetche
-#include <TObject.h>
#include <TString.h>
#include "AliCDBRunRange.h"
class AliMUONRegionalTriggerConfig;
class AliMUONGlobalCrateConfig;
class AliMUONRejectList;
+class AliMUONRecoParam;
-class AliMUONCDB : public TObject
+namespace AliMUONCDB
{
-public:
- /// Ctor. change the path for testing the Shuttle preprocessor, to
- /// "local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB"
- AliMUONCDB(const char* cdbpath = "local://$ALICE_ROOT/OCDB");
- virtual ~AliMUONCDB();
+ Bool_t CheckOCDB(Bool_t pathOnly = kFALSE);
+ Bool_t CheckMapping(Bool_t segmentationOnly = kFALSE);
- void SetMaxNofChannelsToGenerate(Int_t n);
+ Bool_t LoadField();
+ Bool_t LoadMapping(Bool_t segmentationOnly = kFALSE);
+ AliMUONRecoParam* LoadRecoParam();
Int_t MakeNeighbourStore(AliMUONVStore& neighbourStore);
Int_t MakeOccupancyMapStore(AliMUONVStore& occupancyMap, Bool_t defaultValues);
AliMUONRejectList* MakeRejectListStore(Bool_t defaultValues);
- Int_t MakeLocalTriggerMaskStore(AliMUONVStore& ltm) const;
- Int_t MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) const;
- Int_t MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) const;
+ Int_t MakeLocalTriggerMaskStore(AliMUONVStore& ltm);
+ Int_t MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm);
+ Int_t MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm);
- AliMUONTriggerLut* MakeTriggerLUT(const char* file="$(ALICE_ROOT)/MUON/data/lutAptLpt1Hpt1p7.root") const;
- AliMUONTriggerEfficiencyCells* MakeTriggerEfficiency(const char* file="$ALICE_ROOT/MUON/data/efficiencyCells.dat") const;
+ AliMUONTriggerLut* MakeTriggerLUT(const char* file="$(ALICE_ROOT)/MUON/data/lutAptLpt1Hpt1p7.root");
+ AliMUONTriggerEfficiencyCells* MakeTriggerEfficiency(const char* file="$ALICE_ROOT/MUON/data/efficiencyCells.dat");
- /// Compute the difference between two (compatible) stores
- AliMUONVStore* Diff(AliMUONVStore& store1, AliMUONVStore& store2,
- const char* opt="abs");
-
+ AliMUONVStore* Diff(AliMUONVStore& store1, AliMUONVStore& store2, const char* opt="abs");
+
void Plot(const AliMUONVStore& store, const char* name, Int_t nbins=512);
- void WriteToCDB(const char* calibpath, TObject* object,
+ void WriteToCDB(const char* calibpath, TObject* object,
Int_t startRun, Int_t endRun, Bool_t defaultValues);
- void WriteToCDB(const char* calibpath, TObject* object,
+ void WriteToCDB(const char* calibpath, TObject* object,
Int_t startRun, Int_t endRun, const char* filename);
void WriteToCDB(TObject* object, const char* calibpath, Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity(),
- const char* comment="", const char* responsible="AliMUONCDB tester class");
+ const char* comment="", const char* responsible="AliMUONCDB tester class");
void WriteTrigger(Bool_t defaultValues=kTRUE, Int_t startRun=0,Int_t endRun=AliCDBRunRange::Infinity());
void WriteTracker(Bool_t defaultValues=kTRUE, Int_t startRun=0,Int_t endRun=AliCDBRunRange::Infinity());
void WriteNeighbours(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
void WriteHV(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
- void WriteTriggerDCS(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
void WritePedestals(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
void WriteGains(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
void WriteCapacitances(Bool_t defaultValues, Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
void WriteRegionalTriggerConfig(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
void WriteGlobalTriggerConfig(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
+ void WriteTriggerDCS(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
void WriteTriggerLut(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
void WriteTriggerEfficiency(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
-
-private:
- /// Not implemented
- AliMUONCDB(const AliMUONCDB& rhs);
- /// Not implemented
- AliMUONCDB& operator=(const AliMUONCDB& rhs);
-
-private:
- TString fCDBPath; //!< where to write stuff
- Int_t fMaxNofChannelsToGenerate; //!< to limit the number of generated channels (debug)
-
- ClassDef(AliMUONCDB,0) // Helper class to experience OCDB
-};
+}
#endif
for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent )
{
nev++;
- tree->GetEvent(ievent);
- if (!fESD)
+ if (tree->GetEvent(ievent) <= 0)
{
Error("CheckESD", "no ESD object found for event %d", ievent);
return ;
#include <TMath.h>
#include <TMatrixD.h>
#include <Riostream.h>
+#include <TGeoGlobalMagField.h>
+#include <TVirtualMagField.h>
//-----------------------------------------------------------------------------
/// \class AliMUONESDInterface
}
//_____________________________________________________________________________
-void AliMUONESDInterface::LoadEvent(AliESDEvent& esdEvent)
+void AliMUONESDInterface::LoadEvent(AliESDEvent& esdEvent, Bool_t refit)
{
/// Extract MUON data from the given ESD event
if (!esdTrack->ContainTrackerData()) continue;
// add it to track store
- AliMUONTrack* track = Add(*esdTrack, *fTracks);
+ AliMUONTrack* track = Add(*esdTrack, *fTracks, refit);
// prepare cluster map
AliMpExMap* cMap = new AliMpExMap;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//_____________________________________________________________________________
-void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam)
+void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam, Bool_t info)
{
/// Reset the MUON tracker using "recoParam" if provided.
/// If not provided, will use Kalman filter + Smoother
fgRecoParam = new AliMUONRecoParam(*recoParam);
+ if (info) cout<<"I-AliMUONESDInterface::ResetTracker: will refit tracks with provided RecoParam:"<<endl;
+
} else {
fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
cout<<"W-AliMUONESDInterface::ResetTracker: RecoParam not provided. Will use default LowFlux parametrization:"<<endl;
+
+ }
+
+ // print useful parameters for refitting
+ if (info) {
cout<<" --> Tracking mode = "<<fgRecoParam->GetTrackingMode()<<endl;
if (fgRecoParam->UseSmoother()) cout<<" --> Use Smoother"<<endl;
else cout<<" --> Do not use smoother"<<endl;
cout<<" --> Vertex dispersion in bending direction = "
- <<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
-
+ <<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
}
+ if (!TGeoGlobalMagField::Instance()->GetField())
+ cout<<"W-AliMUONESDInterface::ResetTracker: Magnetic field has not been set --> assume field is OFF"<<endl;
+
fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0);
}
}
//_____________________________________________________________________________
-void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track)
+void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track, Bool_t refit)
{
/// Transfert data from ESDMuon track to MUON track.
- /// The track parameters at each cluster are obtained by refitting the track
+ /// If refit = kTRUE, the track parameters at each cluster are obtained by refitting the track
/// or by extrapolating the parameters at the first one if the refit failed.
+ /// If refit = kFALSE, only the track parameters at first cluster are valid.
/// note: You can set the recoParam used to refit the MUON track with ResetTracker(...);
/// By default we use Kalman filter + Smoother
esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().After(esdCluster);
}
- // recompute parameters at first cluster in case of those stored
- // in ESD are not related to the most upstream cluster
- AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
- firstTrackParam->SetZ(esdTrack.GetZUncorrected()); // reset the z to the one stored in ESD
- AliMUONTrackExtrap::ExtrapToZCov(firstTrackParam,firstTrackParam->GetClusterPtr()->GetZ());
-
// refit the track to get better parameters and covariances at each cluster (temporary disable track improvement)
- if (!fgTracker) ResetTracker();
- if (!fgTracker->RefitTrack(track, kFALSE) && track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) track.UpdateCovTrackParamAtCluster();
+ if (refit) {
+
+ AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
+ AliMUONTrackParam paramSave(*firstTrackParam);
+
+ if (!fgTracker) ResetTracker();
+
+ if (!fgTracker->RefitTrack(track, kFALSE) && track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) {
+ *firstTrackParam = paramSave;
+ track.UpdateCovTrackParamAtCluster();
+ }
+
+ }
} else {
{
/// Transfert data from ESDMuon pad to MUON digit
+ if (!AliMpSegmentation::Instance(kFALSE)) {
+ cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
+ return;
+ }
+
const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());
AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
}
//___________________________________________________________________________
-AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore)
+AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit)
{
/// Create MUON track from ESDMuon track and add it to the store
+ /// Track parameters at each clusters are recomputed or not depending on the flag "refit"
/// return a pointer to the track into the store (0x0 if the track already exist)
if(trackStore.FindObject(esdTrack.GetUniqueID())) return 0x0;
AliMUONTrack* track = trackStore.Add(AliMUONTrack());
- ESDToMUON(esdTrack, *track);
+ ESDToMUON(esdTrack, *track, refit);
return track;
}
virtual void Clear(Option_t* = "");
- void LoadEvent(AliESDEvent& esdEvent);
+ void LoadEvent(AliESDEvent& esdEvent, Bool_t refit = kTRUE);
/// Return internal track store
AliMUONVTrackStore* GetTracks() const {return fTracks;}
public: // static methods
- /// Reset the MUON tracker (using "recoParam" if provided)
- static void ResetTracker(const AliMUONRecoParam* recoParam = 0x0);
+ // Reset the MUON tracker (using "recoParam" if provided)
+ static void ResetTracker(const AliMUONRecoParam* recoParam = 0x0, Bool_t info = kTRUE);
/// Set the version of track store
static void UseTrackStore(TString name) {fgTrackStoreName = name;}
static void SetParamCov(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
// ESDMuon objects --> MUON objects conversion
- static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track);
+ static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track, Bool_t refit = kTRUE);
static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLocalTrigger& locTrg);
static void ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUONVCluster& cluster);
static void ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit);
// Add ESD object into the corresponding MUON store
// return a pointer to the corresponding MUON object into the store
- static AliMUONTrack* Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore);
+ static AliMUONTrack* Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit = kTRUE);
static void Add(const AliESDMuonTrack& esdTrack, AliMUONVTriggerStore& triggerStore);
static AliMUONVCluster* Add(const AliESDMuonCluster& esdCluster, AliMUONVClusterStore& clusterStore);
static AliMUONVDigit* Add(const AliESDMuonPad& esdPad, AliMUONVDigitStore& digitStore);
delete fRecoTrackStore; fRecoTrackStore = 0x0;
}
+//_____________________________________________________________________________
+Int_t AliMUONRecoCheck::GetRunNumber()
+{
+ /// Return the run number of the current ESD event
+
+ if (fESDEventOwner && fRecoTrackStore == 0x0) {
+ if (!fESDTree || fESDTree->GetEvent(fCurrentEvent) <= 0) {
+ AliError(Form("fails to read ESD object for event %d: cannot get the run number",fCurrentEvent));
+ return -1;
+ }
+ }
+
+ return fESDEvent->GetRunNumber();
+}
+
//_____________________________________________________________________________
Int_t AliMUONRecoCheck::NumberOfEvents() const
{
}
//_____________________________________________________________________________
-AliMUONVTrackStore* AliMUONRecoCheck::ReconstructedTracks(Int_t event)
+AliMUONVTrackStore* AliMUONRecoCheck::ReconstructedTracks(Int_t event, Bool_t refit)
{
/// Return a track store containing the reconstructed tracks (converted into
- /// MUONTrack objects) for a given event
+ /// MUONTrack objects) for a given event.
+ /// Track parameters at each clusters are computed or not depending on the flag "refit".
+ /// If not, only the track parameters at first cluster are valid.
if (!fESDEventOwner) {
- MakeReconstructedTracks();
+ if (fRecoTrackStore == 0x0) MakeReconstructedTracks(refit);
return fRecoTrackStore;
}
AliError(Form("fails to read ESD object for event %d", event));
return 0x0;
}
- MakeReconstructedTracks();
+ MakeReconstructedTracks(refit);
return fRecoTrackStore;
}
}
/// MUONTrack objects) for a given event
if (!fESDEventOwner) {
- MakeTrackRefs();
+ if (fTrackRefStore == 0x0) MakeTrackRefs();
return fTrackRefStore;
}
/// Return a track store containing the reconstructible tracks for a given event
if (!fESDEventOwner) {
- if (TrackRefs(event) == 0x0) return 0x0;
- MakeReconstructibleTracks();
+ if (fRecoTrackRefStore == 0x0) {
+ if (TrackRefs(event) == 0x0) return 0x0;
+ MakeReconstructibleTracks();
+ }
return fRecoTrackRefStore;
}
}
//_____________________________________________________________________________
-void AliMUONRecoCheck::MakeReconstructedTracks()
+void AliMUONRecoCheck::MakeReconstructedTracks(Bool_t refit)
{
/// Make reconstructed tracks
if (!(fRecoTrackStore = AliMUONESDInterface::NewTrackStore())) return;
Int_t nTracks = (Int_t) fESDEvent->GetNumberOfMuonTracks();
for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
AliESDMuonTrack* esdTrack = fESDEvent->GetMuonTrack(iTrack);
- if (esdTrack->ContainTrackerData()) AliMUONESDInterface::Add(*esdTrack, *fRecoTrackStore);
+ if (esdTrack->ContainTrackerData()) AliMUONESDInterface::Add(*esdTrack, *fRecoTrackStore, refit);
}
}
virtual ~AliMUONRecoCheck();
/// Return the list of reconstructed tracks
- AliMUONVTrackStore* ReconstructedTracks(Int_t event);
+ AliMUONVTrackStore* ReconstructedTracks(Int_t event, Bool_t refit = kTRUE);
/// Return reference muon tracks
AliMUONVTrackStore* TrackRefs(Int_t event);
/// Return reconstructible reference tracks
AliMUONVTrackStore* ReconstructibleTracks(Int_t event);
+ /// Return the run number of the current ESD event
+ Int_t GetRunNumber();
+
/// Return the total number of events.
Int_t NumberOfEvents() const;
void ResetStores();
- void MakeReconstructedTracks();
+ void MakeReconstructedTracks(Bool_t refit);
void MakeTrackRefs();
// load ESD event in the interface
AliMUONESDInterface esdInterface;
- if (GetRecoParam()) AliMUONESDInterface::ResetTracker(GetRecoParam());
+ if (GetRecoParam()) AliMUONESDInterface::ResetTracker(GetRecoParam(), kFALSE);
else AliError("Unable to get recoParam: use default ones for residual calculation");
esdInterface.LoadEvent(*esd);
#if !defined(__CINT__) || defined(__MAKECINT__)
// ROOT includes
-#include <TTree.h>
#include <TFile.h>
#include <TH1.h>
#include <TCanvas.h>
#include <Riostream.h>
#include <TROOT.h>
#include <TClonesArray.h>
-#include <TGeoGlobalMagField.h>
#include <TLorentzVector.h>
// STEER includes
#include "AliLog.h"
-#include "AliMagF.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
-#include "AliESDMuonCluster.h"
-#include "AliCDBPath.h"
-#include "AliCDBEntry.h"
#include "AliCDBManager.h"
// MUON includes
+#include "AliMUONCDB.h"
#include "AliMUONTrack.h"
#include "AliMUONVTrackStore.h"
#include "AliMUONTrackParam.h"
-#include "AliMUONTrackExtrap.h"
-#include "AliMUONESDInterface.h"
#include "AliMUONRecoCheck.h"
#include "AliMUONVCluster.h"
#include "AliMUONRecoParam.h"
/// Results are saved in the root file DiFakes.root
/// Results are relevent provided that you use the same recoParams as for the reconstruction
-void Prepare(AliMUONRecoParam *&recoParam, Double_t &sigmaCut);
-TTree* GetESDTree(TFile *esdFile);
Bool_t TrackMatched(AliMUONTrack &track, AliMUONTrack &trackRef, Float_t &fractionOfMatchCluster, Double_t sigmaCut);
-AliMUONTrack* MatchWithTrackRef(AliESDMuonTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
+AliMUONTrack* MatchWithTrackRef(AliMUONTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
Float_t &fractionOfMatchCluster, Bool_t useLabel, Double_t sigmaCut);
//-----------------------------------------------------------------------
void DIMUONFakes(Bool_t useLabel = kFALSE, Int_t FirstEvent = 0, Int_t LastEvent = -1,
- const TString esdFileName = "AliESDs.root", const TString SimDir = "./generated/")
+ const TString esdFileName = "AliESDs.root", const TString SimDir = "./generated/",
+ const TString ocdbPath = "local://$ALICE_ROOT/OCDB")
{
//Reset ROOT and connect tree file
TH1F *hPhiM = new TH1F("hPhiM"," matched track phi distribution",100,-1.,9.);
TH1F *hPhiF = new TH1F("hPhiF"," fake track phi distribution",100,-1.,9.);
- // prepare for analysis
- AliMUONRecoParam *recoParam = 0x0;
- Double_t sigmaCut = -1;
- Prepare(recoParam, sigmaCut);
+ // link to reconstructed and simulated tracks
+ AliMUONRecoCheck rc(esdFileName, SimDir);
- // link to reconstructed tracks
- TFile* esdFile = TFile::Open(esdFileName);
- TTree* esdTree = GetESDTree(esdFile);
- AliESDEvent* esd = new AliESDEvent();
- esd->ReadFromTree(esdTree);
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(rc.GetRunNumber());
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
- // link to simulated tracks
- AliMUONRecoCheck rc(esdFileName, SimDir);
+ // get sigma cut from recoParam to associate clusters with TrackRefs in case the label are not used
+ Double_t sigmaCut = (recoParam->ImproveTracks()) ? recoParam->GetSigmaCutForImprovement() : recoParam->GetSigmaCutForTracking();
TLorentzVector vMu1, vMu2, vDiMu;
// Loop over ESD events
FirstEvent = TMath::Max(0, FirstEvent);
- LastEvent = (LastEvent>=0) ? TMath::Min((Int_t)esdTree->GetEntries() - 1, LastEvent) : (Int_t)esdTree->GetEntries() - 1;
+ LastEvent = (LastEvent>=0) ? TMath::Min(rc.NumberOfEvents() - 1, LastEvent) : rc.NumberOfEvents() - 1;
for (Int_t iEvent = FirstEvent; iEvent <= LastEvent; iEvent++) {
- // get the ESD of current event
- esdTree->GetEvent(iEvent);
- if (!esd) {
- Error("CheckESD", "no ESD object found for event %d", iEvent);
- return;
- }
-
- // convert TrackRef to MUON tracks
+ // get reconstructed and simulated tracks
+ AliMUONVTrackStore* muonTrackStore = rc.ReconstructedTracks(iEvent, kFALSE);
AliMUONVTrackStore* trackRefStore = rc.TrackRefs(iEvent);
+ if (!muonTrackStore || !trackRefStore) continue;
// loop over ESD tracks and flag them
+ const AliESDEvent* esd = rc.GetESDEvent();
Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
- AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
+ AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
// skip ghosts
- if (!muonTrack->ContainTrackerData()) continue;
+ if (!esdTrack->ContainTrackerData()) continue;
+
+ // find the corresponding MUON track
+ AliMUONTrack* muonTrack = (AliMUONTrack*) muonTrackStore->FindObject(esdTrack->GetUniqueID());
// try to match the reconstructed track with a simulated one
Float_t fractionOfMatchCluster = 0.;
if (matchedTrackRef) {
// flag matched tracks
- muonTrack->SetLabel(matchedTrackRef->GetUniqueID());
+ esdTrack->SetLabel(matchedTrackRef->GetUniqueID());
// remove already matched trackRefs
trackRefStore->Remove(*matchedTrackRef);
} else {
// flag fake tracks
- muonTrack->SetLabel(-1);
+ esdTrack->SetLabel(-1);
}
cDiFakesSummary.Write();
histoFile->Close();
- // clear memory
- delete esd;
- esdFile->Close();
- delete recoParam;
-
-}
-
-//-----------------------------------------------------------------------
-void Prepare(AliMUONRecoParam *&recoParam, Double_t &sigmaCut)
-{
- /// Set the magnetic field and return recoParam and sigmaCut to associate cluster and trackRef
-
- // prepare OCDB access
- AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
- man->SetRun(0);
-
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
- // set the magnetic field for track extrapolations
- AliMUONTrackExtrap::SetField();
-
- // Load initial reconstruction parameters from OCDB
- AliCDBPath path("MUON","Calib","RecoParam");
- AliCDBEntry *entry=man->Get(path.GetPath());
- if(entry) {
- recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject());
- entry->SetOwner(0);
- AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
- }
- if (!recoParam) {
- printf("Couldn't find RecoParam object in OCDB: create default one");
- recoParam = AliMUONRecoParam::GetLowFluxParam();
- }
-
- Info("MUONFakes", "\n recontruction parameters:");
- recoParam->Print("FULL");
- AliMUONESDInterface::ResetTracker(recoParam);
-
- // sigma cut to associate clusters with TrackRefs in case the label are not used
- sigmaCut = (recoParam->ImproveTracks()) ? recoParam->GetSigmaCutForImprovement() : recoParam->GetSigmaCutForTracking();
-
-}
-
-//-----------------------------------------------------------------------
-TTree* GetESDTree(TFile *esdFile)
-{
- /// Check that the file is properly open
- /// Return pointer to the ESD Tree
-
- if (!esdFile || !esdFile->IsOpen()) {
- Error("GetESDTree", "opening ESD file failed");
- exit(-1);
- }
-
- TTree* tree = (TTree*) esdFile->Get("esdTree");
- if (!tree) {
- Error("GetESDTree", "no ESD tree found");
- exit(-1);
- }
-
- return tree;
-
}
//-----------------------------------------------------------------------
}
//-----------------------------------------------------------------------
-AliMUONTrack* MatchWithTrackRef(AliESDMuonTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
+AliMUONTrack* MatchWithTrackRef(AliMUONTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
Float_t &fractionOfMatchCluster, Bool_t useLabel, Double_t sigmaCut)
{
/// Return if the trackRef matched with the reconstructed track and the fraction of matched clusters
if (useLabel) { // by using the MC label
// get the corresponding simulated track if any
- Int_t label = muonTrack.GetLabel();
+ Int_t label = muonTrack.GetMCLabel();
matchedTrackRef = (AliMUONTrack*) trackRefStore.FindObject(label);
// get the fraction of matched clusters
if (matchedTrackRef) {
Int_t nMatchClusters = 0;
- if (muonTrack.ClustersStored()) {
- AliESDMuonCluster* cluster = (AliESDMuonCluster*) muonTrack.GetClusters().First();
- while (cluster) {
- if (cluster->GetLabel() == label) nMatchClusters++;
- cluster = (AliESDMuonCluster*) muonTrack.GetClusters().After(cluster);
- }
- }
- fractionOfMatchCluster = ((Float_t)nMatchClusters) / ((Float_t)muonTrack.GetNClusters());
+ Int_t nClusters = muonTrack.GetNClusters();
+ for (Int_t iCl = 0; iCl < nClusters; iCl++)
+ if (((AliMUONTrackParam*) muonTrack.GetTrackParamAtCluster()->UncheckedAt(iCl))->GetClusterPtr()->GetMCLabel() == label)
+ nMatchClusters++;
+ fractionOfMatchCluster = ((Float_t)nMatchClusters) / ((Float_t)nClusters);
}
} else { // by comparing cluster/TrackRef positions
- // convert ESD track to MUON track
- AliMUONTrack track;
- AliMUONESDInterface::ESDToMUON(muonTrack,track);
-
// look for the corresponding simulated track if any
TIter next(trackRefStore.CreateIterator());
AliMUONTrack* trackRef;
// check compatibility
Float_t f = 0.;
- if (TrackMatched(track, *trackRef, f, sigmaCut)) {
+ if (TrackMatched(muonTrack, *trackRef, f, sigmaCut)) {
matchedTrackRef = trackRef;
fractionOfMatchCluster = f;
break;
#include <TParticle.h>
#include <TSystem.h>
#include <TGeoManager.h>
-#include <TGeoGlobalMagField.h>
+#include "AliMUONCDB.h"
#include "AliMUONRecoCheck.h"
#include "AliMUONTrack.h"
-#include "AliMUONTrackParam.h"
#include "AliMUONTrackLight.h"
#include "AliMUONPairLight.h"
#include "AliMUONVTrackStore.h"
#include "AliESDVertex.h"
#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
-#include "AliMagF.h"
-#include "AliGRPManager.h"
+#include "AliStack.h"
+#include "AliCDBManager.h"
/*TODO: need to update this with changes made to ITS
#include "AliITSVertexerPPZ.h"
#include "AliITSLoader.h"
*/
-#include "AliTracker.h"
#endif
}
}
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliGRPManager *grpMan = new AliGRPManager();
- grpMan->ReadGRPEntry();
- grpMan->SetMagField();
- delete grpMan;
- }
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ AliCDBManager::Instance()->SetRun(0);
+ if (!AliMUONCDB::LoadField()) return;
// set the magnetic field for track extrapolations
AliMUONTrackExtrap::SetField();
muonArray->Clear(); // clean muon and dimuon arrays
dimuonArray->Clear();
- AliMUONVTrackStore* recoTracks = rc->ReconstructedTracks(ievent); // Use tracks from actual reconstruction, but this does not work anymore.
+ AliMUONVTrackStore* recoTracks = rc->ReconstructedTracks(ievent, kFALSE); // Use tracks from actual reconstruction.
//AliMUONVTrackStore* trackRefs = rc->ReconstructibleTracks(ievent); // Only use reconstructible reference tracks.
AliMUONVTrackStore* trackRefs = rc->TrackRefs(ievent);
AliStack* pstack = (const_cast<AliMCEventHandler*>(rc->GetMCEventHandler()))->MCEvent()->Stack();
#include "AliMUONAlignment.h"
#include "AliMUONTrack.h"
-#include "AliMUONTrackExtrap.h"
+#include "AliMUONRecoParam.h"
#include "AliMUONTrackParam.h"
#include "AliMUONGeometryTransformer.h"
#include "AliMUONESDInterface.h"
+#include "AliMUONCDB.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
-#include "AliMagF.h"
-#include "AliTracker.h"
-#include "AliGRPManager.h"
#include "AliCDBManager.h"
#include "AliCDBMetaData.h"
#include "AliCDBId.h"
}
}
- // CDB manager
+ // load necessary data from OCDB
AliCDBManager* cdbManager = AliCDBManager::Instance();
cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
cdbManager->SetRun(0);
-
- // set mag field
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliGRPManager *grpMan = new AliGRPManager();
- grpMan->ReadGRPEntry();
- grpMan->SetMagField();
- delete grpMan;
- }
- // set the magnetic field for track extrapolations
- AliMUONTrackExtrap::SetField();
+ if (!AliMUONCDB::LoadField()) return;
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
+
+ // reset tracker for restoring initial track parameters at cluster
+ AliMUONESDInterface::ResetTracker(recoParam);
Double_t parameters[4*156];
Double_t errors[4*156];
#include <TMath.h>
// STEER includes
-#include "AliMagF.h"
-#include "AliTracker.h"
#include "AliESDEvent.h"
#include "AliRecoParam.h"
#include "AliCDBManager.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
+#include "AliHeader.h"
// MUON includes
#include "AliMpConstants.h"
-#include "AliMpCDB.h"
#include "AliMpSegmentation.h"
#include "AliMpVSegmentation.h"
#include "AliMpPad.h"
+#include "AliMUONCDB.h"
#include "AliMUONCalibrationData.h"
#include "AliMUONVCalibParam.h"
#include "AliMUONPadInfo.h"
const Int_t printLevel = 1;
-void Prepare();
TTree* GetESDTree(TFile *esdFile);
UInt_t buildClusterMap(AliMUONTrack &track);
//-----------------------------------------------------------------------
-void MUONClusterInfo(Int_t nevents = -1, const char* esdFileName = "AliESDs.root",
- const char* inFileName = "galice.root", const char* outFileName = "clusterInfo.root")
+void MUONClusterInfo(Int_t nevents = -1, const char* esdFileName = "AliESDs.root", const char* inFileName = "galice.root",
+ const TString ocdbPath = "local://$ALICE_ROOT/OCDB", const char* outFileName = "clusterInfo.root")
{
/// 1) if (esdFileName != "")
/// loop over ESD event and fill AliMUONClusterInfo object with cluster + corresponding track parameters;
AliMUONVClusterStore* clusterStore = 0x0;
AliMUONVDigitStore* digitStore = 0x0;
- // prepare the refitting during ESD->MUON conversion
- Prepare();
-
// open the ESD file and tree and connect the ESD event
TFile* esdFile = 0x0;
TTree* esdTree = 0x0;
AliESDEvent* esd = 0x0;
+ Int_t runNumber = -1;
if (useESD) {
esdFile = TFile::Open(esdFileName);
esdTree = GetESDTree(esdFile);
esd = new AliESDEvent();
esd->ReadFromTree(esdTree);
+ if (esdTree->GetEvent(0) <= 0) {
+ Error("MUONClusterInfo", "no ESD object found for event 0");
+ return;
+ }
+ runNumber = esd->GetRunNumber();
}
// get the cluster from RecPoints
MUONLoader = rl->GetDetectorLoader("MUON");
MUONLoader->LoadRecPoints("READ");
MUONLoader->LoadDigits("READ");
+ rl->LoadHeader();
+ if (runNumber < 0) runNumber = rl->GetHeader()->GetRun();
}
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(runNumber);
+ if (!AliMUONCDB::LoadField()) return;
+ if (!AliMUONCDB::LoadMapping(kTRUE)) return;
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
+
+ // reset tracker for track restoring initial track parameters at cluster
+ AliMUONESDInterface::ResetTracker(recoParam);
+
+ // prepare access to calibration data
+ calibData = new AliMUONCalibrationData(runNumber);
+
// prepare the output tree
gROOT->cd();
TFile* clusterInfoFile = TFile::Open(outFileName, "RECREATE");
}
}
- // prepare access to calibration data
- if (useESD && !calibData) calibData = new AliMUONCalibrationData(esd->GetESDRun()->GetRunNumber());
- else if (!calibData) calibData = new AliMUONCalibrationData(rl->GetRunNumber());
-
//----------------------------------------------//
// ------------- fill cluster info ------------ //
//----------------------------------------------//
if (useRecPoints) {
MUONLoader->UnloadDigits();
MUONLoader->UnloadRecPoints();
+ rl->UnloadHeader();
delete rl;
}
if (useESD) {
cout<<endl<<"time to fill cluster/track info: R:"<<timer.RealTime()<<" C:"<<timer.CpuTime()<<endl<<endl;
}
-//-----------------------------------------------------------------------
-void Prepare()
-{
- /// Set the magnetic field, the mapping and the reconstruction parameters
-
- gRandom->SetSeed(0);
-
- // set mag field
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
-
- // Load mapping
- AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
- man->SetRun(0);
- if ( ! AliMpCDB::LoadDDLStore() ) {
- Error("Prepare","Could not access mapping from OCDB !");
- exit(-1);
- }
-
- // Reset the reconstruction parameters for track refitting if needed
- // (by default will use Kalman filter + Smoother)
- // AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
- // AliMUONESDInterface::ResetTracker(muonRecoParam);
-
-}
-
//-----------------------------------------------------------------------
TTree* GetESDTree(TFile *esdFile)
{
#if !defined(__CINT__) || defined(__MAKECINT__)
// ROOT includes
-#include <TTree.h>
#include <TFile.h>
#include <TH1.h>
#include <TCanvas.h>
#include <Riostream.h>
#include <TROOT.h>
#include <TClonesArray.h>
-#include <TGeoGlobalMagField.h>
#include <TArrayI.h>
// STEER includes
#include "AliLog.h"
-#include "AliMagF.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
-#include "AliESDMuonCluster.h"
-#include "AliCDBPath.h"
-#include "AliCDBEntry.h"
#include "AliCDBManager.h"
// MUON includes
+#include "AliMUONCDB.h"
#include "AliMUONTrack.h"
#include "AliMUONVTrackStore.h"
#include "AliMUONTrackParam.h"
-#include "AliMUONTrackExtrap.h"
#include "AliMUONESDInterface.h"
#include "AliMUONRecoCheck.h"
#include "AliMUONVCluster.h"
/// Results are saved in the root file Fakes.root
/// Results are relevent provided that you use the same recoParams as for the reconstruction
-void Prepare(AliMUONRecoParam *&recoParam, Double_t &sigmaCut);
-TTree* GetESDTree(TFile *esdFile);
Bool_t TrackMatched(AliMUONTrack &track, AliMUONTrack &trackRef, Float_t &fractionOfMatchCluster, Double_t sigmaCut);
Bool_t IsRecontructible(AliMUONTrack &track, AliMUONRecoParam &recoParam);
-AliMUONTrack* MatchWithTrackRef(AliESDMuonTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
+AliMUONTrack* MatchWithTrackRef(AliMUONTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
Float_t &fractionOfMatchCluster, Bool_t useLabel, Double_t sigmaCut);
Int_t RemoveConnectedFakes(AliMUONVTrackStore &fakeTrackStore, AliMUONVTrackStore &trackRefStore, AliMUONRecoParam &recoParam,
Bool_t useLabel, Double_t sigmaCut, TH1F &hFractionOfConnectedClusters);
//-----------------------------------------------------------------------
void MUONFakes(Bool_t useLabel = kFALSE, Int_t FirstEvent = 0, Int_t LastEvent = -1,
- const TString esdFileName = "AliESDs.root", const TString SimDir = "./generated/")
+ const TString esdFileName = "AliESDs.root", const TString SimDir = "./generated/",
+ const TString ocdbPath = "local://$ALICE_ROOT/OCDB")
{
//Reset ROOT and connect tree file
TH1F *hPhiM = new TH1F("hPhiM"," matched track phi distribution",100,-1.,9.);
TH1F *hPhiF = new TH1F("hPhiF"," fake track phi distribution",100,-1.,9.);
- // prepare for analysis
- AliMUONRecoParam *recoParam = 0x0;
- Double_t sigmaCut = -1;
- Prepare(recoParam, sigmaCut);
+ // link to reconstructed and simulated tracks
+ AliMUONRecoCheck rc(esdFileName, SimDir);
- // link to reconstructed tracks
- TFile* esdFile = TFile::Open(esdFileName);
- TTree* esdTree = GetESDTree(esdFile);
- AliESDEvent* esd = new AliESDEvent();
- esd->ReadFromTree(esdTree);
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(rc.GetRunNumber());
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
- // link to simulated tracks
- AliMUONRecoCheck rc(esdFileName, SimDir);
+ // get sigma cut from recoParam to associate clusters with TrackRefs in case the label are not used
+ Double_t sigmaCut = (recoParam->ImproveTracks()) ? recoParam->GetSigmaCutForImprovement() : recoParam->GetSigmaCutForTracking();
// initialize global counters
Int_t nReconstructibleTracks = 0;
// Loop over ESD events
FirstEvent = TMath::Max(0, FirstEvent);
- LastEvent = (LastEvent>=0) ? TMath::Min((Int_t)esdTree->GetEntries() - 1, LastEvent) : (Int_t)esdTree->GetEntries() - 1;
+ LastEvent = (LastEvent>=0) ? TMath::Min(rc.NumberOfEvents() - 1, LastEvent) : rc.NumberOfEvents() - 1;
for (Int_t iEvent = FirstEvent; iEvent <= LastEvent; iEvent++) {
- // get the ESD of current event
- esdTree->GetEvent(iEvent);
- if (!esd) {
- Error("CheckESD", "no ESD object found for event %d", iEvent);
- return;
- }
-
- // convert TrackRef to MUON tracks
+ // get reconstructed and simulated tracks
+ AliMUONVTrackStore* muonTrackStore = rc.ReconstructedTracks(iEvent, kFALSE);
AliMUONVTrackStore* trackRefStore = rc.TrackRefs(iEvent);
+ if (!muonTrackStore || !trackRefStore) continue;
// count the number of reconstructible tracks
TIter next(trackRefStore->CreateIterator());
Int_t nTrackerTracks = 0;
trackReconstructedYet = kFALSE;
AliMUONVTrackStore *fakeTrackStore = AliMUONESDInterface::NewTrackStore();
+ const AliESDEvent* esd = rc.GetESDEvent();
Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
- AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
+ AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
// skip ghosts
- if (!muonTrack->ContainTrackerData()) continue;
+ if (!esdTrack->ContainTrackerData()) continue;
nTrackerTracks++;
+ // find the corresponding MUON track
+ AliMUONTrack* muonTrack = (AliMUONTrack*) muonTrackStore->FindObject(esdTrack->GetUniqueID());
+
// get track info
- Int_t nClusters = muonTrack->GetNClusters();
- Double_t normalizedChi2 = muonTrack->GetChi2() / (2. * muonTrack->GetNHit() - 5);
- Double_t p = muonTrack->P();
- Double_t pT = muonTrack->Pt();
- Double_t eta = muonTrack->Eta();
- Double_t phi = muonTrack->Phi();
+ Int_t nClusters = esdTrack->GetNClusters();
+ Double_t normalizedChi2 = esdTrack->GetChi2() / (2. * esdTrack->GetNHit() - 5);
+ Double_t p = esdTrack->P();
+ Double_t pT = esdTrack->Pt();
+ Double_t eta = esdTrack->Eta();
+ Double_t phi = esdTrack->Phi();
// fill global histograms
hNumberOfClusters->Fill(nClusters);
hPhiF->Fill(phi);
// store fake tracks
- AliMUONESDInterface::Add(*muonTrack, *fakeTrackStore);
+ fakeTrackStore->Add(*muonTrack);
}
cout << "REMINDER: results are relevent provided that you use the same recoParams as for the reconstruction" << endl;
cout << endl;
- // clear memory
- delete esd;
- esdFile->Close();
- delete recoParam;
-
-}
-
-//-----------------------------------------------------------------------
-void Prepare(AliMUONRecoParam *&recoParam, Double_t &sigmaCut)
-{
- /// Set the magnetic field and return recoParam and sigmaCut to associate cluster and trackRef
-
- // prepare OCDB access
- AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
- man->SetRun(0);
-
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1., AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
- // set the magnetic field for track extrapolations
- AliMUONTrackExtrap::SetField();
-
- // Load initial reconstruction parameters from OCDB
- AliCDBPath path("MUON","Calib","RecoParam");
- AliCDBEntry *entry=man->Get(path.GetPath());
- if(entry) {
- recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject());
- entry->SetOwner(0);
- AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
- }
- if (!recoParam) {
- printf("Couldn't find RecoParam object in OCDB: create default one");
- recoParam = AliMUONRecoParam::GetLowFluxParam();
- }
-
- Info("MUONFakes", "\n recontruction parameters:");
- recoParam->Print("FULL");
- AliMUONESDInterface::ResetTracker(recoParam);
-
- // sigma cut to associate clusters with TrackRefs in case the label are not used
- sigmaCut = (recoParam->ImproveTracks()) ? recoParam->GetSigmaCutForImprovement() : recoParam->GetSigmaCutForTracking();
-
-}
-
-//-----------------------------------------------------------------------
-TTree* GetESDTree(TFile *esdFile)
-{
- /// Check that the file is properly open
- /// Return pointer to the ESD Tree
-
- if (!esdFile || !esdFile->IsOpen()) {
- Error("GetESDTree", "opening ESD file failed");
- exit(-1);
- }
-
- TTree* tree = (TTree*) esdFile->Get("esdTree");
- if (!tree) {
- Error("GetESDTree", "no ESD tree found");
- exit(-1);
- }
-
- return tree;
-
}
//-----------------------------------------------------------------------
}
//-----------------------------------------------------------------------
-AliMUONTrack* MatchWithTrackRef(AliESDMuonTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
+AliMUONTrack* MatchWithTrackRef(AliMUONTrack &muonTrack, AliMUONVTrackStore &trackRefStore,
Float_t &fractionOfMatchCluster, Bool_t useLabel, Double_t sigmaCut)
{
/// Return if the trackRef matched with the reconstructed track and the fraction of matched clusters
if (useLabel) { // by using the MC label
// get the corresponding simulated track if any
- Int_t label = muonTrack.GetLabel();
+ Int_t label = muonTrack.GetMCLabel();
matchedTrackRef = (AliMUONTrack*) trackRefStore.FindObject(label);
// get the fraction of matched clusters
if (matchedTrackRef) {
Int_t nMatchClusters = 0;
- if (muonTrack.ClustersStored()) {
- AliESDMuonCluster* cluster = (AliESDMuonCluster*) muonTrack.GetClusters().First();
- while (cluster) {
- if (cluster->GetLabel() == label) nMatchClusters++;
- cluster = (AliESDMuonCluster*) muonTrack.GetClusters().After(cluster);
- }
- }
- fractionOfMatchCluster = ((Float_t)nMatchClusters) / ((Float_t)muonTrack.GetNClusters());
+ Int_t nClusters = muonTrack.GetNClusters();
+ for (Int_t iCl = 0; iCl < nClusters; iCl++)
+ if (((AliMUONTrackParam*) muonTrack.GetTrackParamAtCluster()->UncheckedAt(iCl))->GetClusterPtr()->GetMCLabel() == label)
+ nMatchClusters++;
+ fractionOfMatchCluster = ((Float_t)nMatchClusters) / ((Float_t)nClusters);
}
} else { // by comparing cluster/TrackRef positions
- // convert ESD track to MUON track
- AliMUONTrack track;
- AliMUONESDInterface::ESDToMUON(muonTrack,track);
-
// look for the corresponding simulated track if any
TIter next(trackRefStore.CreateIterator());
AliMUONTrack* trackRef;
// check compatibility
Float_t f = 0.;
- if (TrackMatched(track, *trackRef, f, sigmaCut)) {
+ if (TrackMatched(muonTrack, *trackRef, f, sigmaCut)) {
matchedTrackRef = trackRef;
fractionOfMatchCluster = f;
break;
// look for the most connected fake track
AliMUONTrack *connectedFake = 0x0;
- Float_t fractionOfConnectedClusters = 0.;
+ Double_t fractionOfConnectedClusters = 0.;
TIter next2(fakeTrackStore.CreateIterator());
AliMUONTrack* fakeTrack;
while ( ( fakeTrack = static_cast<AliMUONTrack*>(next2()) ) ) {
if (nConnectedClusters == 0) continue;
// check if it is the most connected fake track
- Float_t f = ((Float_t)nConnectedClusters) / ((Float_t)fakeTrack->GetNClusters());
+ Double_t f = ((Double_t)nConnectedClusters) / ((Double_t)fakeTrack->GetNClusters());
if (f > fractionOfConnectedClusters) {
connectedFake = fakeTrack;
fractionOfConnectedClusters = f;
#if !defined(__CINT__) || defined(__MAKECINT__)
-#include "AliCDBEntry.h"
#include "AliCDBManager.h"
#include "AliCodeTimer.h"
+#include "AliMUONCDB.h"
#include "AliMUONPainterDataRegistry.h"
#include "AliMUONRecoParam.h"
#include "AliMUONTrackerDataMaker.h"
AliMUONVTrackerDataMaker* dm(0x0);
- AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam");
- AliMUONRecoParam* recoParam(0x0);
-
- if ( entry ) recoParam = static_cast<AliMUONRecoParam*>(entry->GetObject());
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return 0;
if ( strlen(cdbPath) > 0 )
{
AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
AliCDBManager::Instance()->SetRun(runNumber);
- AliMpCDB::LoadDDLStore();
- AliMpCDB::LoadManuStore();
+ if (!AliMUONCDB::LoadMapping()) return;
TStopwatch timer1;
TStopwatch timer2;
#include "TClonesArray.h"
#include "TH1.h"
#include "TFile.h"
-#include <TGeoManager.h>
// STEER includes
-#include "AliRun.h"
-#include "AliHeader.h"
-#include "AliMC.h"
-#include "AliStack.h"
-#include "AliMagF.h"
-#include "AliTracker.h"
+#include "AliCDBManager.h"
// MUON includes
+#include "AliMUONCDB.h"
#include "AliMUONConstants.h"
#include "AliMUONTrack.h"
#include "AliMUONRecoCheck.h"
#include "AliMUONTrackParam.h"
#include "AliMUONTrackExtrap.h"
+#include "AliMUONRecoParam.h"
#include "AliMUONVTrackStore.h"
Int_t TrackCheck( Bool_t *compTrack);
-void MUONRecoCheck (Int_t nEvent = -1, char* geoFilename = "geometry.root",
- char * pathSim="./generated/", char * esdFileName="AliESDs.root")
+void MUONRecoCheck (Int_t nEvent = -1, char * pathSim="./generated/", char * esdFileName="AliESDs.root",
+ const char* ocdbPath = "local://$ALICE_ROOT/OCDB")
{
Bool_t compTrack[10];
Int_t iTrack = 0;
AliMUONTrack* trackOK(0x0);
Int_t trackID = 0;
- Double_t sigmaCut = 4.; // 4 sigmas cut
Double_t maxChi2 = 999.;
AliMUONTrackParam *trackParam;
Double_t x1,y1,z1,pX1,pY1,pZ1,p1;
TH1F *hResMomVertex = new TH1F("hResMomVertex"," delta P vertex (GeV/c)",100,-10.,10);
TH1F *hResMomFirstCluster = new TH1F("hResMomFirstCluster"," delta P first cluster (GeV/c)",100,-10.,10);
- // Import TGeo geometry (needed by AliMUONTrackExtrap::ExtrapToVertex)
- if (!gGeoManager) {
- TGeoManager::Import(geoFilename);
- if (!gGeoManager) {
- Error("MUONmass_ESD", "getting geometry from file %s failed", geoFilename);
- return;
- }
- }
+ AliMUONRecoCheck rc(esdFileName, pathSim);
+
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(rc.GetRunNumber());
+ AliMUONCDB::LoadField();
+ AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
// set the magnetic field for track extrapolations
AliMUONTrackExtrap::SetField();
- AliMUONRecoCheck rc(esdFileName, pathSim);
+ // get sigma cut from recoParam to associate clusters with TrackRefs
+ Double_t sigmaCut = (recoParam->ImproveTracks()) ? recoParam->GetSigmaCutForImprovement() : recoParam->GetSigmaCutForTracking();
Int_t nevents = rc.NumberOfEvents();
{
if (!(ievent%10)) printf(" **** event # %d \n",ievent);
- AliMUONVTrackStore* trackStore = rc.ReconstructedTracks(ievent);
+ AliMUONVTrackStore* trackStore = rc.ReconstructedTracks(ievent, kFALSE);
AliMUONVTrackStore* trackRefStore = rc.ReconstructibleTracks(ievent);
hReconstructible->Fill(trackRefStore->GetSize());
#include <TROOT.h>
// STEER includes
-#include "AliMagF.h"
-#include "AliTracker.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
-#include "AliRecoParam.h"
#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
-#include "AliCDBPath.h"
#include "AliGeomManager.h"
// MUON includes
-#include "AliMpCDB.h"
+#include "AliMUONCDB.h"
#include "AliMUONRecoParam.h"
#include "AliMUONESDInterface.h"
#include "AliMUONRefitter.h"
#include "AliMUONTrack.h"
#include "AliMUONVTrackStore.h"
#include "AliMUONTrackParam.h"
-#include "AliMUONTrackExtrap.h"
#endif
const Int_t printLevel = 1;
-void Prepare();
TTree* GetESDTree(TFile *esdFile);
//-----------------------------------------------------------------------
-void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", const char* esdFileNameOut = "AliESDs_New.root")
+void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", const char* esdFileNameOut = "AliESDs_New.root",
+ const char* geoFilename = "geometry.root", const char* ocdbPath = "local://$ALICE_ROOT/OCDB")
{
+ /// Example of muon refitting:
/// refit ESD tracks from ESD pads (i.e. re-clusterized the attached ESD clusters);
/// reset the charge of the digit using their raw charge before refitting;
/// compare results with original ESD tracks;
/// write results in a new ESD file
- // prepare the refitting
- gRandom->SetSeed(1);
- Prepare();
-
- // reconstruction parameters for the refitting
- AliMUONRecoParam* recoParam = AliMUONRecoParam::GetLowFluxParam();
- Info("MUONRefit", "\n Reconstruction parameters for refitting:");
- recoParam->Print("FULL");
-
- AliMUONESDInterface esdInterface;
- AliMUONRefitter refitter(recoParam);
- refitter.Connect(&esdInterface);
-
// open the ESD file and tree
TFile* esdFile = TFile::Open(esdFileNameIn);
TTree* esdTree = GetESDTree(esdFile);
// connect ESD event to the ESD tree
AliESDEvent* esd = new AliESDEvent();
esd->ReadFromTree(esdTree);
-
+
+ // get run number
+ if (esdTree->GetEvent(0) <= 0) {
+ Error("MUONRefit", "no ESD object found for event 0");
+ return;
+ }
+ Int_t runNumber = esd->GetRunNumber();
+
+ // Import TGeo geometry
+ if (!gGeoManager) {
+ AliGeomManager::LoadGeometry(geoFilename);
+ if (!gGeoManager) {
+ Error("MUONRefit", "getting geometry from file %s failed", "generated/galice.root");
+ exit(-1);
+ }
+ }
+
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(runNumber);
+ if (!AliMUONCDB::LoadField()) return;
+ if (!AliMUONCDB::LoadMapping(kTRUE)) return;
+
+ // reconstruction parameters for the refitting
+ AliMUONRecoParam* recoParam = AliMUONRecoParam::GetLowFluxParam();
+ Info("MUONRefit", "\n Reconstruction parameters for refitting:");
+ recoParam->Print("FULL");
+
+ AliMUONESDInterface esdInterface;
+ AliMUONRefitter refitter(recoParam);
+ refitter.Connect(&esdInterface);
+ gRandom->SetSeed(1);
+
// timer start...
TStopwatch timer;
if (nTracks < 1) continue;
// load the current event
- esdInterface.LoadEvent(*esd);
+ esdInterface.LoadEvent(*esd, kFALSE);
// loop over digit to modify their charge
AliMUONVDigit *digit;
// free memory
esdFile->Close();
delete esd;
+ delete recoParam;
cout<<endl<<"time to refit: R:"<<timer.RealTime()<<" C:"<<timer.CpuTime()<<endl<<endl;
}
-//-----------------------------------------------------------------------
-void Prepare()
-{
- /// Set the geometry, the magnetic field, the mapping and the reconstruction parameters
-
- // Import TGeo geometry (needed by AliMUONTrackExtrap::ExtrapToVertex)
- if (!gGeoManager) {
- AliGeomManager::LoadGeometry("geometry.root");
- if (!gGeoManager) {
- Error("MUONRefit", "getting geometry from file %s failed", "generated/galice.root");
- return;
- }
- }
-
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
- // set the magnetic field for track extrapolations
- AliMUONTrackExtrap::SetField();
-
- // Load mapping
- AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
- man->SetRun(0);
- if ( ! AliMpCDB::LoadDDLStore() ) {
- Error("MUONRefit","Could not access mapping from OCDB !");
- exit(-1);
- }
-
- // Load initial reconstruction parameters from OCDB
- AliMUONRecoParam* recoParam = 0x0;
- AliCDBPath path("MUON","Calib","RecoParam");
- AliCDBEntry *entry=man->Get(path.GetPath());
- if(entry) {
- recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject());
- entry->SetOwner(0);
- AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
- }
- if (!recoParam) {
- printf("Couldn't find RecoParam object in OCDB: create default one");
- recoParam = AliMUONRecoParam::GetLowFluxParam();
- }
- Info("MUONRefit", "\n initial recontruction parameters:");
- recoParam->Print("FULL");
- AliMUONESDInterface::ResetTracker(recoParam);
-
-}
-
//-----------------------------------------------------------------------
TTree* GetESDTree(TFile *esdFile)
{
// MUON includes
#include "AliMUONCDB.h"
#include "AliMUONTriggerEfficiencyCells.h"
+#include "AliCDBManager.h"
#include "AliCDBRunRange.h"
#include "Riostream.h"
if(!addMapInSimulation) return;
- AliMUONCDB muonCDB;
- muonCDB.WriteToCDB("MUON/Calib/TriggerEfficiency",effMap,0,AliCDBRunRange::Infinity(),true);
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ AliMUONCDB::WriteToCDB("MUON/Calib/TriggerEfficiency",effMap,0,AliCDBRunRange::Infinity(),true);
}
#pragma link C++ class AliMUONDigitMaker+;
#pragma link C++ class AliMUONRawWriter+;
-// calibration access
-#pragma link C++ class AliMUONCDB+;
-
#endif
#if !defined(__CINT__) || defined(__MAKECINT__)
// MUON includes
+#include "AliMUONCDB.h"
#include "AliMUONTrackParam.h"
#include "AliMUONTrackExtrap.h"
#include "AliMUONESDInterface.h"
#include "AliHeader.h"
#include "AliLoader.h"
#include "AliStack.h"
-#include "AliMagF.h"
#include "AliESDEvent.h"
#include "AliESDVertex.h"
-#include "AliTracker.h"
#include "AliCDBManager.h"
#include "AliESDMuonTrack.h"
// ROOT includes
#include "TTree.h"
#include "TNtuple.h"
-#include "TBranch.h"
-#include "TClonesArray.h"
#include "TLorentzVector.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TParticle.h"
-#include "TTree.h"
#include "TString.h"
#include <Riostream.h>
#include <TGeoManager.h>
#include <TROOT.h>
#include <TF1.h>
+#include <TMath.h>
#endif
-Bool_t MUONefficiency( char* filename = "galice.root", char* geoFilename = "geometry.root", char* esdFileName = "AliESDs.root",
- Int_t ExtrapToVertex = -1, Int_t ResType = 553, Int_t FirstEvent = 0, Int_t LastEvent = 1000000 )
+Bool_t MUONefficiency(char* filename = "generated/galice.root", char* esdFileName = "AliESDs.root",
+ char* geoFilename = "geometry.root", 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)
/// - <0: no extrapolation;
// MUONefficiency starts
- // Set default CDB storage
- AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-
Double_t MUON_MASS = 0.105658369;
Double_t UPSILON_MASS = 9.4603 ;
Double_t JPSI_MASS = 3.097;
if (!gGeoManager) {
TGeoManager::Import(geoFilename);
if (!gGeoManager) {
- Error("MUONmass_ESD", "getting geometry from file %s failed", filename);
+ Error("MUONefficiency", "getting geometry from file %s failed", geoFilename);
return kFALSE;
}
}
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
+ // open the ESD file
+ TFile* esdFile = TFile::Open(esdFileName);
+ if (!esdFile || !esdFile->IsOpen()) {
+ Error("MUONefficiency", "opening ESD file %s failed", esdFileName);
+ return kFALSE;
}
+
+ AliESDEvent* esd = new AliESDEvent();
+ TTree* tree = (TTree*) esdFile->Get("esdTree");
+ if (!tree) {
+ Error("MUONefficiency", "no ESD tree found");
+ return kFALSE;
+ }
+ esd->ReadFromTree(tree);
+
+ // get run number
+ if (tree->GetEvent(0) <= 0) {
+ Error("MUONefficiency", "no ESD object found for event 0");
+ return kFALSE;
+ }
+ Int_t runNumber = esd->GetRunNumber();
+
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(runNumber);
+ if (!AliMUONCDB::LoadField()) return kFALSE;
+
// set the magnetic field for track extrapolations
AliMUONTrackExtrap::SetField();
-
// open run loader and load gAlice, kinematics and header
AliRunLoader* runLoader = AliRunLoader::Open(filename);
if (!runLoader) {
Error("MUONefficiency", "no galice object found");
return kFALSE;
}
-
- // open the ESD file
- TFile* esdFile = TFile::Open(esdFileName);
- if (!esdFile || !esdFile->IsOpen()) {
- Error("MUONefficiency", "opening ESD file %s failed", esdFileName);
- return kFALSE;
- }
-
- AliESDEvent* esd = new AliESDEvent();
- TTree* tree = (TTree*) esdFile->Get("esdTree");
- if (!tree) {
- Error("CheckESD", "no ESD tree found");
- return kFALSE;
- }
- esd->ReadFromTree(tree);
runLoader->LoadHeader();
- Int_t runNumber = runLoader->GetHeader()->GetRun();
- AliCDBManager::Instance()->SetRun(runNumber);
+ if (runNumber != runLoader->GetHeader()->GetRun()) {
+ Error("MUONefficiency", "mismatch between run number from ESD and from runLoader");
+ return kFALSE;
+ }
nevents = runLoader->GetNumberOfEvents();
AliMUONTrackParam trackParam;
// get the event summary data
- tree->GetEvent(iEvent);
- if (!esd) {
+ if (tree->GetEvent(iEvent) <= 0) {
Error("CheckESD", "no ESD object found for event %d", iEvent);
return kFALSE;
}
// STEER includes
#include "AliLog.h"
-#include "AliMagF.h"
+#include "AliCDBManager.h"
#include "AliESDEvent.h"
#include "AliESDVertex.h"
-#include "AliTracker.h"
#include "AliESDMuonTrack.h"
// MUON includes
+#include "AliMUONCDB.h"
#include "AliMUONTrackParam.h"
#include "AliMUONTrackExtrap.h"
#include "AliMUONESDInterface.h"
/// \ingroup macros
/// \file MUONmassPlot_ESD.C
-/// \brief Macro MUONefficiency.C for ESD
+/// \brief Macro MUONmassPlot_ESD.C for ESD
///
/// \author Ch. Finck, Subatech, April. 2004
///
///
/// Add parameters and histograms for analysis
-Bool_t MUONmassPlot(Int_t ExtrapToVertex = -1, char* geoFilename = "geometry.root",
- Int_t FirstEvent = 0, Int_t LastEvent = 10000, char* esdFileName = "AliESDs.root", Int_t ResType = 553,
- Float_t Chi2Cut = 100., Float_t PtCutMin = 1., Float_t PtCutMax = 10000.,
- Float_t massMin = 9.17,Float_t massMax = 9.77)
+Bool_t MUONmassPlot(const char* esdFileName = "AliESDs.root", const char* geoFilename = "geometry.root",
+ const char* ocdbPath = "local://$ALICE_ROOT/OCDB",
+ Int_t FirstEvent = 0, Int_t LastEvent = 10000, Int_t ExtrapToVertex = -1,
+ Int_t ResType = 553, Float_t Chi2Cut = 100., Float_t PtCutMin = 1.,
+ Float_t PtCutMax = 10000., Float_t massMin = 9.17,Float_t massMax = 9.77)
{
-/// \param ExtrapToVertex (default -1)
-/// - <0: no extrapolation;
-/// - =0: extrapolation to (0,0,0);
-/// - >0: extrapolation to ESDVertex if available, else to (0,0,0)
-/// \param FirstEvent (default 0)
-/// \param LastEvent (default 0)
-/// \param ResType 553 for Upsilon, anything else for J/Psi (default 553)
-/// \param Chi2Cut to keep only tracks with chi2 per d.o.f. < Chi2Cut (default 100)
-/// \param PtCutMin to keep only tracks with transverse momentum > PtCutMin (default 1)
-/// \param PtCutMax to keep only tracks with transverse momentum < PtCutMax (default 10000)
-/// \param massMin (default 9.17 for Upsilon)
-/// \param massMax (default 9.77 for Upsilon);
-/// to calculate the reconstruction efficiency for resonances with invariant mass
-/// massMin < mass < massMax.
+ /// \param FirstEvent (default 0)
+ /// \param LastEvent (default 10000)
+ /// \param ExtrapToVertex (default -1)
+ /// - <0: no extrapolation;
+ /// - =0: extrapolation to (0,0,0);
+ /// - >0: extrapolation to ESDVertex if available, else to (0,0,0)
+ /// \param ResType 553 for Upsilon, anything else for J/Psi (default 553)
+ /// \param Chi2Cut to keep only tracks with chi2 per d.o.f. < Chi2Cut (default 100)
+ /// \param PtCutMin to keep only tracks with transverse momentum > PtCutMin (default 1)
+ /// \param PtCutMax to keep only tracks with transverse momentum < PtCutMax (default 10000)
+ /// \param massMin (default 9.17 for Upsilon)
+ /// \param massMax (default 9.77 for Upsilon);
+ /// to calculate the reconstruction efficiency for resonances with invariant mass
+ /// massMin < mass < massMax.
cout << "MUONmassPlot " << endl;
cout << "FirstEvent " << FirstEvent << endl;
Double_t fPxRec1, fPyRec1, fPzRec1, fE1;
Double_t fPxRec2, fPyRec2, fPzRec2, fE2;
- Int_t ntrackhits, nevents;
+ Int_t ntrackhits;
Double_t fitfmin;
Double_t fZVertex=0;
Double_t fYVertex=0;
Double_t errYVtx=0;
TLorentzVector fV1, fV2, fVtot;
-
+
// Import TGeo geometry (needed by AliMUONTrackExtrap::ExtrapToVertex)
if (!gGeoManager) {
TGeoManager::Import(geoFilename);
}
}
- // set mag field
- // waiting for mag field in CDB
- if (!TGeoGlobalMagField::Instance()->GetField()) {
- printf("Loading field map...\n");
- AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
- TGeoGlobalMagField::Instance()->SetField(field);
- }
- // set the magnetic field for track extrapolations
- AliMUONTrackExtrap::SetField();
-
-
// open the ESD file
TFile* esdFile = TFile::Open(esdFileName);
if (!esdFile || !esdFile->IsOpen()) {
Error("MUONmass_ESD", "opening ESD file %s failed", esdFileName);
return kFALSE;
}
-
AliESDEvent* esd = new AliESDEvent();
TTree* tree = (TTree*) esdFile->Get("esdTree");
if (!tree) {
- Error("CheckESD", "no ESD tree found");
+ Error("MUONmass_ESD", "no ESD tree found");
return kFALSE;
}
-// tree->SetBranchAddress("ESD", &esd);
esd->ReadFromTree(tree);
- nevents = (Int_t)tree->GetEntries();
+ // get run number
+ if (tree->GetEvent(0) <= 0) {
+ Error("MUONmass_ESD", "no ESD object found for event 0");
+ return kFALSE;
+ }
+ Int_t runNumber = esd->GetRunNumber();
+
+ // load necessary data from OCDB
+ AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+ AliCDBManager::Instance()->SetRun(runNumber);
+ if (!AliMUONCDB::LoadField()) return kFALSE;
+
+ // set the magnetic field for track extrapolations
+ AliMUONTrackExtrap::SetField();
AliMUONTrackParam trackParam;
// Loop over events
+ Int_t nevents = (Int_t)tree->GetEntries();
for (Int_t iEvent = FirstEvent; iEvent <= TMath::Min(LastEvent, nevents - 1); iEvent++) {
// get the event summary data
- tree->GetEvent(iEvent);
- if (!esd) {
- Error("CheckESD", "no ESD object found for event %d", iEvent);
+ if (tree->GetEvent(iEvent) <= 0) {
+ Error("MUONmass_ESD", "no ESD object found for event %d", iEvent);
return kFALSE;
}
-
+
// get the SPD reconstructed vertex (vertexer) and fill the histogram
AliESDVertex* Vertex = (AliESDVertex*) esd->GetVertex();
if (Vertex->GetNContributors()) {
// condition for good track (Chi2Cut and PtCut)
- if ((ch1 < Chi2Cut) && (pt1 > PtCutMin) && (pt1 < PtCutMax)) {
+// if ((ch1 < Chi2Cut) && (pt1 > PtCutMin) && (pt1 < PtCutMax)) {
// fill histos hPtMuon and hChi2PerDof
hPtMuon->Fill(pt1);
Float_t ch2 = fitfmin / (2.0 * ntrackhits - 5);
// condition for good track (Chi2Cut and PtCut)
- if ((ch2 < Chi2Cut) && (pt2 > PtCutMin) && (pt2 < PtCutMax)) {
+// if ((ch2 < Chi2Cut) && (pt2 > PtCutMin) && (pt2 < PtCutMax)) {
// condition for opposite charges
if ((fCharge1 * fCharge2) == -1) {
}
} // if (fCharge1 * fCharge2) == -1)
- } // if ((ch2 < Chi2Cut) && (pt2 > PtCutMin) && (pt2 < PtCutMax))
+// } // if ((ch2 < Chi2Cut) && (pt2 > PtCutMin) && (pt2 < PtCutMax))
delete muonTrack2;
} // for (Int_t iTrack2 = iTrack + 1; iTrack2 < iTrack; iTrack2++)
- } // if (ch1 < Chi2Cut) && (pt1 > PtCutMin)&& (pt1 < PtCutMax) )
+// } // if (ch1 < Chi2Cut) && (pt1 > PtCutMin)&& (pt1 < PtCutMax) )
delete muonTrack;
} // for (Int_t iTrack = 0; iTrack < nrectracks; iTrack++)
#pragma link C++ class AliMUONQAMappingCheck+;
+// OCDB access
+#pragma link C++ class AliMUONCDB+;
+
#endif
}
// save RecoParam in CDB
- AliMUONCDB cdb;
- cdb.WriteToCDB(&recoParams, "MUON/Calib/RecoParam", startRun, endRun, "reconstruction parameters for MUON", "Philippe Pillot");
+ AliMUONCDB::WriteToCDB(&recoParams, "MUON/Calib/RecoParam", startRun, endRun, "reconstruction parameters for MUON", "Philippe Pillot");
}
param->Print("FULL");
// save RecoParam in CDB
- AliMUONCDB cdb;
- cdb.WriteToCDB(param, "MUON/Calib/RecoParam", startRun, endRun, "reconstruction parameters for MUON", "Philippe Pillot");
+ AliMUONCDB::WriteToCDB(param, "MUON/Calib/RecoParam", startRun, endRun, "reconstruction parameters for MUON", "Philippe Pillot");
}
AliMUONCDB class is used to populate the CDB with fake calibration objects for testing purposes.
Real calibration data will normally be handled by the Shuttle (see READMEshuttle).
-The various WriteXXX() methods may be used to populate MUON tracker and trigger
+The various WriteXXX() static methods may be used to populate MUON tracker and trigger
information.
A full set of calibration data types can be created from scratch using, from
the Root prompt (from within the $ALICE_ROOT/MUON directory to get the correct
<pre>
root[0] AliMpCDB::LoadAll2();
-root[1] AliMUONCDB cdb;
-root[2] Int_t startRun = 0;
-root[3] Bool_t defaultValues = kTRUE;
-root[4] cdb.WriteTrigger(startRun);
-root[5] cdb.WriteTracker(defaultValues,startRun);
+root[1] Int_t startRun = 0;
+root[2] Bool_t defaultValues = kTRUE;
+root[3] AliMUONCDB::WriteTrigger(startRun);
+root[4] AliMUONCDB::WriteTracker(defaultValues,startRun);
</pre>
</pre>
If you want to plot calibration data (not terribly usefull as it's a really global view),
- use the Plot() function of AliMUONCDB, e.g.
+ use the Plot() function of AliMUONCDB (this require to load the segmentation), e.g.
<pre>
-AliMUONCDB cdb(cdbpath);
-cdb.Plot(*ped,"pedestal")
+AliCDBManager::Instance()->SetRun(0);
+AliMUONCDB::LoadMapping(kTRUE);
+AliMUONCDB::Plot(*ped,"pedestal");
</pre>
which will create 2 histograms : pedestal_0 (mean) and pedestal_1 (sigma).
- <code>SetDefaultBendingReso(Int_t iCh, Double_t val)</code>: Set the default bending resolution of chamber iCh
- <code>SetMaxTriggerTracks(Int_t val)</code>: Set the maximum number of trigger tracks above which the tracking is cancelled
- <code>SetMaxTrackCandidates(Int_t val)</code>: Set the maximum number of track candidates above which the tracking abort
+- <code>SetManuOccupancyLimits(float low, float high)</code>: Set the limits for the acceptable manu occupancy
+- <code>SetBuspatchOccupancyLimits(float low, float high)</code>: Set the limits for the acceptable bp occupancy
+- <code>SetDEOccupancyLimits(float low, float high)</code>: Set the limits for the acceptable DE occupancy
We can use the method Print("FULL") to printout all the parameters and options set in the class AliMUONRecoParam.
\section rec_s6 Conversion between MUON/ESD objects
Every conversion between MUON objects (AliMUONVDigit/AliMUONVCluster/AliMUONTrack) and ESD objects
-(AliESDMuonPad/AliESDMuonCluster/AliESDMuonTrack) is done by the class AliMUONESDInterface. There are 2 ways of using this class:
+(AliESDMuonPad/AliESDMuonCluster/AliESDMuonTrack) is done by the class AliMUONESDInterface.
+
+WARNING: some of these conversions require input from outside, namely the magnetic field map, the geometry, the reconstruction parameters
+and/or the mapping segmentation. In particular:
+- The conversion of ESDPads to MUON digits requires the mapping segmentation.
+- The conversion of a MUON track to an ESD track requires the magnetic field and the geometry to extrapolate the track parameters at vertex
+and compute the correction of multiple scattering and energy loss in the front absorber.
+- While converting an ESD track to a MUON track, the track is refitted by using the cluster position stored in ESD in order to recover the
+track parameters at each cluster. This refitting needs both the magnetic field and the reconstruction parameters initially used to
+reconstruct the tracks to be correct. The reconstruction parameters can be passed to the interface by using the static method
+AliMUONESDTrack::ResetTracker(const AliMUONRecoParam* recoParam, Bool_t info). The refitting can however be disconnected by user (using flag
+in the fonction parameters). In that case, none of these external inputs is necessary anymore but only the track parameters at first cluster,
+which is then copied directly from the ESD, is meaningful.
+
+There are 2 ways of using this class:
1) Using the static methods to convert the objects one by one (and possibly put them into the provided store):
- Get track parameters at vertex, at DCA, ...:
AliMUONESDInterface::MUONToESD(*locTrg, esdTrack, trackId, triggerTrack);
\endverbatim
-- Convert an AliESDMuonTrack to an AliMUONTrack:
+- Convert an AliESDMuonTrack to an AliMUONTrack (the parameters at each clusters are recomputed or not according to the flag "refit".
+if not, only the parameters at first cluster are relevant):
\verbatim
...
AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
AliMUONTrack track;
- AliMUONESDInterface::ESDToMUON(*esdTrack, track);
+ AliMUONESDInterface::ESDToMUON(*esdTrack, track, refit);
\endverbatim
-- Add an AliESDMuonTrack (converted into AliMUONTrack object) into an AliMUONVTrackStore:
+- Add an AliESDMuonTrack (converted into AliMUONTrack object) into an AliMUONVTrackStore (same remark as above about the flag "refit"):
\verbatim
...
AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
AliMUONVTrackStore *trackStore = AliMUONESDInteface::NewTrackStore();
- AliMUONTrack* trackInStore = AliMUONESDInterface::Add(*esdTrack, *trackStore);
+ AliMUONTrack* trackInStore = AliMUONESDInterface::Add(*esdTrack, *trackStore, refit);
\endverbatim
2) Loading an entire ESDEvent and using the finders and/or the iterators to access the corresponding MUON objects:
\section rec_s7 ESD cluster/track refitting
We can re-clusterize and re-track the clusters/tracks stored into the ESD by using the class AliMUONRefitter. This class gets the MUON objects
-to be refitted from an instance of AliMUONESDInterface (see section @ref rec_s6), then uses the reconstruction framework to refit the
-objects. The reconstruction parameters are still set via the class AliMUONRecoParam (see section @ref rec_s5). The initial data are not changed.
-Results are stored into new MUON objects. The aim of the refitting is to be able to study effects of changing the reconstruction parameter, the
-calibration parameters or the alignment without re-running the entire reconstruction.
+to be refitted from an instance of AliMUONESDInterface (see section @ref rec_s6), then uses the reconstruction framework to refit them. The new
+reconstruction parameters are still set via the class AliMUONRecoParam (see section @ref rec_s4) and passed to refitter through its constructor.
+The old reconstruction parameters, the mapping, the magnetic field and/or the geometry may also be needed to convert the ESD objects to MUON ones
+and/or to refit them. The initial data are not changed. Results are stored into new MUON objects. The aim of the refitting is to be able to
+study effects of changing the reconstruction parameter, the calibration parameters or the alignment without re-running the entire reconstruction.
To use this class we first have to connect it to the ESD interface containing MUON objects:
\verbatim
We've written an AliMUONPedestalEventGenerator which creates fake pedestal events. The pedestal values
are taken from the Offline Condition DataBase (OCDB) (which is itself fakely filled
-using the WritePedestals() method of AliMUONCDB class
+using the static WritePedestals() method of AliMUONCDB class
So first generate a valid pedestal CDB entry by using the AliMUONCDB class. There's one
little trick : you should first point to the "default" OCDB (local://$ALICE_ROOT/OCDB) in
root[] AliMpCDB::LoadDDLStore(); // only if you've not put the mapping in test OCDB
// below are lines to be executed whatever you did with the mapping...
root[] const char* cdbpath="local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB"; // where to put the CDB
-root[] AliMUONCDB cdb(cdbpath)
+root[] AliCDBManager::Instance()->SetDefaultStorage(cdbpath);
root[] Bool_t defaultValues = kFALSE; // to generate random values instead of plain zeros...
root[] Int_t startRun = 80;
root[] Int_t endRun = 80;
-root[] cdb.WritePedestals(defaultValues, startRun, endRun);
+root[] AliMUONCDB::WritePedestals(defaultValues, startRun, endRun);
</pre>
Expected output is (don't worry about the warnings, they are harmless) :
<pre>
const char* cdbpath="local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB"; // where to put the CDB
-AliMUONCDB cdb(cdbpath)
+root[] AliCDBManager::Instance()->SetDefaultStorage(cdbpath);
Bool_t defaultValues = kFALSE; // to generate random values instead of plain zeros...
Int_t gainRun = 80;
Int_t pedRun = 81;
-cdb.WritePedestals(defaultValues, pedRun, pedRun);
-cdb.WriteGains(defaultValues, gainRun, gainRun);
+AliMUONCDB::WritePedestals(defaultValues, pedRun, pedRun);
+AliMUONCDB::WriteGains(defaultValues, gainRun, gainRun);
</pre>
Expected output is (don't worry about the warnings, they are harmless) :
#include "AliRunLoader.h"
#include "AliLoader.h"
#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
-#include "AliCDBPath.h"
// tracker
#include "AliGeomManager.h"
// MUON
-#include "AliMpCDB.h"
-#include "AliMpDDL.h"
-#include "AliMpDDLStore.h"
#include "AliMpConstants.h"
// trigger
#include "AliMUONDigitStoreV2R.h"
#include "AliMUONVCluster.h"
#include "AliMUONRecoParam.h"
+#include "AliMUONCDB.h"
#endif
AliMUONDigitStoreV2R digitStoreTrackCut;
AliMUONVCluster* cluster = 0x0;
- // Load segmentation
+ // Load mapping
AliCDBManager::Instance()->SetDefaultStorage(cdbStorage.Data());
AliCDBManager::Instance()->SetRun(runNumber);
-
- AliMpCDB::LoadDDLStore();
+ if (!AliMUONCDB::LoadMapping()) return;
AliMUONGeometryTransformer* transformer = 0x0;
// Load geometry data
transformer->LoadGeometryData();
// Load reconstruction parameters
- AliCDBPath path("MUON","Calib","RecoParam");
- AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath());
- if(entry) {
- recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject());
- entry->SetOwner(0);
- AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
- }
- if (!recoParam) {
- printf("Couldn't find RecoParam object in OCDB: create default one");
- recoParam = AliMUONRecoParam::GetLowFluxParam();
- }
+ recoParam = AliMUONCDB::LoadRecoParam();
+ if (!recoParam) return;
recoParam->Print("FULL");
clusterFinder = new AliMUONClusterFinderMLEM(kFALSE,new AliMUONPreClusterFinder);
clusterServer = new AliMUONSimpleClusterServer(clusterFinder,*transformer);
AliMUONRawClusterV2.cxx \
AliMUONDigitMaker.cxx \
AliMUONRawWriter.cxx \
- AliMUONCDB.cxx \
AliMUONVDigitStore.cxx \
AliMUONDigitStoreV1.cxx \
AliMUONDigitStoreV1Iterator.cxx \
AliMUONTriggerTrackToTrackerClusters.cxx \
AliMUONVTrackerDataMaker.cxx \
AliMUONTrackerDataMaker.cxx \
- AliMUONQAMappingCheck.cxx
+ AliMUONQAMappingCheck.cxx \
+ AliMUONCDB.cxx
HDRS:= $(SRCS:.cxx=.h)
delete AliMpDDLStore::Instance(false);
delete AliMpSegmentation::Instance(false);
delete AliMpDEStore::Instance(false);
+ delete AliMpManuStore::Instance(false);
}