]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRecoParam.cxx
Correct compilation warnings in AliMUONTriggerGUI.
[u/mrichter/AliRoot.git] / MUON / AliMUONRecoParam.cxx
index 5780d4fae0a11a948fd05854075835d8fcf56382..fafb9b296807b4fd445beb6ef8ddc4f24e9eec3c 100644 (file)
 #include "AliRecoParam.h"
 #include "AliLog.h"
 
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
 #include <Riostream.h>
 
+using std::cout;
+using std::endl;
 ClassImp(AliMUONRecoParam)
 
 
@@ -73,9 +78,18 @@ AliMUONRecoParam::AliMUONRecoParam()
   fMaxTriggerTracks(0),
   fMaxTrackCandidates(0),
   fSelectTrackOnSlope(kFALSE),
-  fMissingPadFractionLimit(0),
-  fFractionOfBuspatchOutsideOccupancyLimit(0)
-{
+  fMissingPadFractionLimit(-1),
+  fFractionOfBuspatchOutsideOccupancyLimit(0),
+  fAverageNoisePadCharge(0.22875),
+  fClusterChargeCut(2.0),
+  fEventSizeSoftLimit(35.0),
+  fEventSizeHardLimit(45.0),
+  fTokenLostLimit(0.0),
+  fTryRecover(kFALSE),
+  fDiscardMonoCathodClusters(kFALSE),
+  fMonoCathodClNonBendingRes(0.),
+  fMonoCathodClBendingRes(0.)
+{  
   /// Constructor
   
   SetNameTitle("Dummy","Dummy");
@@ -183,10 +197,10 @@ void AliMUONRecoParam::SetLowFluxParam()
   fMaxBendingDistanceToTrack = 1.;
   fSigmaCutForTracking = 6.;
   fSigmaCutForImprovement = 5.;
-  fSigmaCutForTrigger = 8.;
+  fSigmaCutForTrigger = 4.;
   fStripCutForTrigger = 1.;
   fMaxStripAreaForTrigger = 3.;
-  fMaxNormChi2MatchTrigger = 16.;
+  fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
   fCombinedClusterTrackReco = kFALSE;
   fTrackAllTracks = kTRUE;
   fRecoverTracks = kTRUE;
@@ -194,7 +208,7 @@ void AliMUONRecoParam::SetLowFluxParam()
   fMakeMoreTrackCandidates = kFALSE;
   fComplementTracks = kTRUE;
   fImproveTracks = kTRUE;
-  fRemoveConnectedTracksInSt12 = kTRUE;
+  fRemoveConnectedTracksInSt12 = kFALSE;
   fUseSmoother = kTRUE;
   for (Int_t iCh = 0; iCh < 10; iCh++) {
     fUseChamber[iCh] = kTRUE;
@@ -205,6 +219,9 @@ void AliMUONRecoParam::SetLowFluxParam()
   fBypassSt45 = 0;
   fMaxTriggerTracks = 100;
   fMaxTrackCandidates = 10000;  
+  fDiscardMonoCathodClusters = kFALSE;
+  fMonoCathodClNonBendingRes = 10.;
+  fMonoCathodClBendingRes = 10.;
 }
 
 //_____________________________________________________________________________
@@ -225,10 +242,10 @@ void AliMUONRecoParam::SetHighFluxParam()
   fMaxBendingDistanceToTrack = 1.;
   fSigmaCutForTracking = 6.;
   fSigmaCutForImprovement = 5.;
-  fSigmaCutForTrigger = 8.;
+  fSigmaCutForTrigger = 4.;
   fStripCutForTrigger = 1.;
   fMaxStripAreaForTrigger = 3.;
-  fMaxNormChi2MatchTrigger = 16.;
+  fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
   fCombinedClusterTrackReco = kFALSE;
   fTrackAllTracks = kTRUE;
   fRecoverTracks = kTRUE;
@@ -247,7 +264,9 @@ void AliMUONRecoParam::SetHighFluxParam()
   fBypassSt45 = 0;
   fMaxTriggerTracks = 100;
   fMaxTrackCandidates = 10000;
-  
+  fDiscardMonoCathodClusters = kFALSE;
+  fMonoCathodClNonBendingRes = 10.;
+  fMonoCathodClBendingRes = 10.;
 }
 
 //_____________________________________________________________________________
@@ -268,10 +287,10 @@ void AliMUONRecoParam::SetCosmicParam()
   fMaxBendingDistanceToTrack = 1.;
   fSigmaCutForTracking = 7.;
   fSigmaCutForImprovement = 6.;
-  fSigmaCutForTrigger = 8.;
+  fSigmaCutForTrigger = 4.;
   fStripCutForTrigger = 1.5;
   fMaxStripAreaForTrigger = 3.;
-  fMaxNormChi2MatchTrigger = 16.;
+  fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
   fPercentOfFullClusterInESD = 100.;
   fCombinedClusterTrackReco = kFALSE;
   fTrackAllTracks = kTRUE;
@@ -297,12 +316,15 @@ void AliMUONRecoParam::SetCosmicParam()
   fPadGoodnessMask = 0x400BE80; // Ped Mean is Zero | Ped Mean Too Low | Ped Mean Too High | Ped Sigma Too Low | Ped Sigma Too High | Ped is missing | HV is missing | manu occupancy too high
   fMaxTriggerTracks = 100;
   fMaxTrackCandidates = 10000;
+  fDiscardMonoCathodClusters = kFALSE;
+  fMonoCathodClNonBendingRes = 10.;
+  fMonoCathodClBendingRes = 10.;
+  
   SetPedMeanLimits(20, 700);
   SetManuOccupancyLimits(-1.,0.01); // reject manu above occ=1%
 
-  SetBuspatchOccupancyLimits(-1,0.01);  
-  SetMissingPadFractionLimit(0.1); // 10 %   
-  SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %   
+  SetBuspatchOccupancyLimits(-1,0.05);  
+  SetFractionOfBuspatchOutsideOccupancyLimit(0.10); // 10 %
 }
 
 
@@ -347,6 +369,8 @@ void AliMUONRecoParam::Print(Option_t *option) const
   
   if (IsDefault()) cout<<"\t\t*** Parameters used by default ***"<<endl;
   
+  cout << "Event Specie=" << GetEventSpecie() << endl;
+  
   cout<<Form("Calibration mode = %s",fCalibrationMode.Data())<<endl;
   cout<<Form("Clustering mode = %s",fClusteringMode.Data())<<endl;
   cout<<Form("Tracking mode = %s",fTrackingMode.Data())<<endl;
@@ -475,8 +499,11 @@ void AliMUONRecoParam::Print(Option_t *option) const
   
   cout << "The pad limits we are using are :" << endl;
   
-  cout << Form("%5.0f <= HVSt12 <= %5.0f Volts",HVSt12LowLimit(),HVSt12HighLimit()) << endl;
-  cout << Form("%5.0f <= HVSt345 <= %5.0f Volts",HVSt345LowLimit(),HVSt345HighLimit()) << endl;
+  for ( int ichamber = 0; ichamber < 10; ++ichamber ) 
+  {
+    cout << Form("HV Ch %d must be >= %5.2f",ichamber,HVLimit(ichamber)) << endl;
+  }
+
   cout << Form("%7.2f <= Pedestal mean <= %7.2f",PedMeanLowLimit(),PedMeanHighLimit()) << endl;
   cout << Form("%7.2f <= Pedestal sigma <= %7.2f",PedSigmaLowLimit(),PedSigmaHighLimit()) << endl;
   cout << Form("%e <= Gain linear term <= %e",GainA1LowLimit(),GainA1HighLimit()) << endl;
@@ -487,13 +514,21 @@ void AliMUONRecoParam::Print(Option_t *option) const
   
   cout << "Occupancy limits are :" << endl;
   
-  cout << Form("%e <= Manu occupancy < %7.2f",ManuOccupancyLowLimit(),ManuOccupancyHighLimit()) << endl;
-  cout << Form("%e <= Buspatch occupancy < %7.2f",BuspatchOccupancyLowLimit(),BuspatchOccupancyHighLimit()) << endl;
-  cout << Form("%e <= DE occupancy < %7.2f",DEOccupancyLowLimit(),DEOccupancyHighLimit()) << endl;
+  cout << Form("%e <= Manu occupancy < %7.3f",ManuOccupancyLowLimit(),ManuOccupancyHighLimit()) << endl;
+  cout << Form("%e <= Buspatch occupancy < %7.3f",BuspatchOccupancyLowLimit(),BuspatchOccupancyHighLimit()) << endl;
+  cout << Form("%e <= DE occupancy < %7.3f",DEOccupancyLowLimit(),DEOccupancyHighLimit()) << endl;
   
   cout << "'QAChecker' limits" << endl;  
-  cout << Form("MissingPadFractionLimit = %5.2f %%",MissingPadFractionLimit()*100.0) << endl;  
   cout << Form("FractionOfBuspatchOutsideOccupancyLimit = %5.2f %%",FractionOfBuspatchOutsideOccupancyLimit()*100.0) << endl;
+  cout << Form("Event size limit = %5.2f KB/event (soft) and %5.2f KB/event (hard)",fEventSizeSoftLimit,fEventSizeHardLimit) << endl;
+  if ( fTokenLostLimit > 0 )
+  {
+    cout << Form("We tolerate up to %5.2f %% token lost errors per event",fTokenLostLimit) << endl;
+  }
+  else
+  {
+    cout << "We dot not tolerate any token lost error !" << endl;
+  }
   
   cout << "chamber non bending resolution = |";
   for (Int_t iCh = 0; iCh < 10; iCh++) cout << Form(" %6.3f |",fDefaultNonBendingReso[iCh]);
@@ -503,23 +538,80 @@ void AliMUONRecoParam::Print(Option_t *option) const
   cout << endl;
   cout<<Form("maximum number of trigger tracks above which the tracking is cancelled = %d",fMaxTriggerTracks)<<endl;
   cout<<Form("maximum number of track candidates above which the tracking is abandonned = %d",fMaxTrackCandidates)<<endl;
+
+  cout << Form("The average noise pad charge is assumed to be %7.2f fC",AverageNoisePadCharge()) << endl;
+  cout << Form("and clusters below %5.2f times this noise charge (i.e. %7.2f fC) are discarded",
+               ClusterChargeCut(),ClusterChargeCut()*AverageNoisePadCharge()) << endl;
+  cout << Form("Note that LowestPadCharge is then %7.2f fC",LowestPadCharge()) << endl;
+  
+  if (strstr(option,"FULL")) {
+    cout<<"Try to improve the reconstructed tracks by changing the resolution of mono-cathod clusters: ";
+    if (fDiscardMonoCathodClusters) cout<<Form("ON (res = %6.3f, %6.3f)",fMonoCathodClNonBendingRes,fMonoCathodClBendingRes)<<endl;
+    else cout<<"OFF"<<endl;
+  } else if (fDiscardMonoCathodClusters)
+    cout<<Form("Try to improve the reconstructed tracks by changing the resolution of mono-cathod clusters (res = %6.3f, %6.3f)",
+              fMonoCathodClNonBendingRes,fMonoCathodClBendingRes)<<endl;
   
+  if (TryRecover())
+  {
+    cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+    cout << "!!! WILL TRY TO RECOVER CORRUPTED RAW DATA !!!" << endl;
+    cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;    
+  }
   cout<<"\t-----------------------------------------------------"<<endl<<endl;
   
 }
 
 //_____________________________________________________________________________
 void
-AliMUONRecoParam::SetDefaultLimits()
+AliMUONRecoParam::SetHVLimit(Int_t chamberId, Double_t value)
 {
-       /// Set the default limits and pad goodness policy
+  /// Set the HV limit for a given chamber (or all chambers 
+  /// if chamberId==-1
+  
+  if ( chamberId == -1 ) 
+  {
+    for ( Int_t i = 0; i < 10; ++i ) 
+    {
+      fHVLimit[i] = value;
+    }
+  }
+  else if ( chamberId >= 0 && chamberId < 10 ) 
+  {
+    fHVLimit[chamberId]=value;
+  }
+  else
+  {
+    AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
+  }
+}
 
-       fHVSt12Limits[0]=1500;
-       fHVSt12Limits[1]=2000;
+//_____________________________________________________________________________
+Double_t AliMUONRecoParam::HVLimit(Int_t chamberId) const
+{
+  /// Get the HV limit for a given chamber
+  if ( chamberId >= 0 && chamberId < 10 )
+  {
+    return fHVLimit[chamberId];
+  }
+  AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
+
+  return 0.0;
+}
 
-       fHVSt345Limits[0]=1500;
-       fHVSt345Limits[1]=2000;
+//_____________________________________________________________________________
+void
+AliMUONRecoParam::SetDefaultLimits()
+{
+       /// Set the default limits and pad goodness policy
 
+  fHVSt12Limits[0]=1500; // kept for backward compatibility only
+       fHVSt12Limits[1]=2000; // kept for backward compatibility only
+       fHVSt345Limits[0]=1500; // kept for backward compatibility only
+       fHVSt345Limits[1]=2000; // kept for backward compatibility only
+  
+  SetHVLimit(-1,1590); // this one is the real HV limit used now
+  
        fPedMeanLimits[0] = 20;
        fPedMeanLimits[1] = 1024;
        
@@ -546,10 +638,212 @@ AliMUONRecoParam::SetDefaultLimits()
   fDEOccupancyLimits[0] = -1.0; 
   fDEOccupancyLimits[1] = 1.0;
 
-  fChargeSigmaCut = 4.0;
-  
-  fMissingPadFractionLimit = 0.1; // 10 % 
+  fMissingPadFractionLimit = -1; // DEPRECATED
   fFractionOfBuspatchOutsideOccupancyLimit = 0.05; // 5 % 
 
+  ChargeSigmaCut(4.0); // pad with charge < 4.0 x sigma will be removed (where sigma is the actual noise of that very pad, i.e. not the average)
+  
+  AverageNoisePadCharge(0.22875); // 0.22875 coulombs ~ 1.5 ADC channels
+
+  ClusterChargeCut(2.0); // will cut cluster below 2.0 x LowestPadCharge()
+  
+  SetEventSizeLimits(35.0,45.0);
+  
+  SetTokenLostLimit(0.0);
+  
+  fTryRecover = kFALSE;
+}
+
+
+//-----------------------------------------------------------------------
+TObjArray* 
+AliMUONRecoParam::Create(const char* settings)
+{
+  /// Create pre-defined recoparam array, according to settings.
+  /// settings is case-insensitive.
+  ///
+  /// Currently defined are :
+  ///
+  /// "cosmics" :
+  ///      Cosmic (default)
+  ///      Calibration
+  /// "ppideal"
+  ///      LowFlux (default)
+  ///      Calibration
+  /// "ppreal"
+  ///      LowFlux (modified to reconstruct real p-p data)
+  ///      Calibration
+  /// "pprealsim"
+  ///      LowFlux (modified to reconstruct realistic p-p simulation)
+  ///      Calibration
+  /// "pbpbreal"
+  ///      HighFlux (modified to reconstruct real Pb-Pb data)
+  ///      Calibration
+  
+  AliMUONRecoParam* param(0x0);
+  
+  AliRecoParam::EventSpecie_t defaultParam = AliRecoParam::kLowMult;
+  
+  TString stype(settings);
+  stype.ToLower();
+  
+  if ( stype == "cosmics" )
+  {
+    // set parameters for cosmic runs
+    param = AliMUONRecoParam::GetCosmicParam();
+    defaultParam = AliRecoParam::kCosmic;
+  }
+  else if ( stype == "ppideal" ) 
+  {
+    // set default lowFlux parameters
+    param = AliMUONRecoParam::GetLowFluxParam();
+  }
+  else if ( stype == "ppreal" || stype == "pprealsim" || stype == "pprealnofield" ) 
+  {      
+    // common parameters for p-p data and realistic p-p simu
+    param = AliMUONRecoParam::GetLowFluxParam();
+    param->SaveFullClusterInESD(kTRUE, 100.);
+    for (Int_t iCh=0; iCh<10; iCh++) 
+    {
+      param->SetDefaultNonBendingReso(iCh,0.4);
+      param->SetDefaultBendingReso(iCh,0.4);
+    }
+    param->SetSigmaCutForTracking(7.);
+    param->SetStripCutForTrigger(1.5);
+    param->SetSigmaCutForTrigger(6.);
+    param->ImproveTracks(kTRUE, 6.);
+    param->SetPedMeanLimits(20, 700);
+    param->SetManuOccupancyLimits(-1.,0.015);
+    param->SetBuspatchOccupancyLimits(-1.,0.05);  
+    param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
+    param->SetEventSizeLimits(45., 65.);
+    param->SetHVLimit(0,1550);
+    param->SetHVLimit(1,1550);
+    param->SetHVLimit(2,1550);
+    param->SetHVLimit(3,1550);
+    
+    // specific parameters for p-p data or realistic p-p simu
+    if ( stype == "ppreal" || stype == "pprealnofield" )
+    {
+      param->SetPadGoodnessMask(0x400BE9B);
+    }
+    else
+    {
+      param->SetPadGoodnessMask(0x8080);      
+    }
+    
+    if ( stype == "pprealnofield" )
+    {
+      param->TryRecover(kTRUE);
+    }
+  }
+  else if ( stype == "pbpbreal" || stype == "pbpbrealsim" ) 
+  {      
+    // common parameters for Pb-Pb data and realistic Pb-Pb simu
+    param = AliMUONRecoParam::GetHighFluxParam();
+    defaultParam = AliRecoParam::kHighMult;
+    param->SaveFullClusterInESD(kTRUE, 100.);
+    for (Int_t iCh=0; iCh<10; iCh++) 
+    {
+      param->SetDefaultNonBendingReso(iCh,0.2);
+      param->SetDefaultBendingReso(iCh,0.2);
+    }
+    param->SetSigmaCutForTracking(5.);
+    param->SetStripCutForTrigger(1.5);
+    param->SetSigmaCutForTrigger(4.);
+    param->ImproveTracks(kTRUE, 4.);
+    param->SetPedMeanLimits(20, 700);
+    param->SetManuOccupancyLimits(-1.,0.03);
+    param->SetBuspatchOccupancyLimits(-1.,0.1); // 10 % (this cut not used for the reco anyway)
+    param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
+    param->SetEventSizeLimits(100., 150.);
+    
+    // specific parameters for Pb-Pb data or realistic Pb-Pb simu
+    if ( stype == "pbpbreal" )
+    {
+      param->SetPadGoodnessMask(0x400BE9B);
+    }
+    else
+    {
+      param->SetPadGoodnessMask(0x8080);      
+    }
+  }
+  else
+  {
+    AliErrorClass("Unknown settings !");
+    return 0x0;
+  }
+
+  TObjArray* recoParams = new TObjArray;
+
+  recoParams->AddLast(param);
+  
+  // set (dummy) parameters for calibration runs
+  param = AliMUONRecoParam::GetCalibrationParam();
+  recoParams->AddLast(param);
+  
+  // set parameters for Pb-Pb runs
+  // param = AliMUONRecoParam::GetHighFluxParam();
+  // recoParams.AddLast(param);
+  
+  // identify default parameters (exit if identification failed)
+  Bool_t defaultIsSet = kFALSE;
+  TIter next(recoParams);
+  while ( (param = static_cast<AliMUONRecoParam*>(next())) ) 
+  {
+    if (param->GetEventSpecie() == defaultParam) 
+    {
+      param->SetAsDefault();
+      defaultIsSet = kTRUE;
+    }
+    param->Print("FULL");
+  }
+  
+  if (!defaultIsSet) 
+  {
+    AliErrorClass("The default reconstruction parameters are not set! Exiting...");
+    return 0x0;
+  }  
+  
+  return recoParams;
 }
 
+//______________________________________________________________________________
+void 
+AliMUONRecoParam::Show(Int_t runNumber, const char* ocdb)
+{
+  /// Show what we have in the designated OCDB for that run, as far as RecoParams are concerned
+  
+  AliCDBManager::Instance()->SetDefaultStorage(ocdb);
+  AliCDBManager::Instance()->SetRun(runNumber);
+  
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam");
+  
+  if (!entry) return;
+  
+  TObject* o = entry->GetObject();
+  
+  if ( o->IsA() == TObjArray::Class() ) 
+  {
+    TObjArray* array = static_cast<TObjArray*>(o);
+    for ( Int_t i = 0; i <= array->GetLast(); ++i ) 
+    {
+      AliDetectorRecoParam* p = static_cast<AliDetectorRecoParam*>(array->At(i));
+      cout << Form("array[%d]=%s %s %s",i,
+                   p ? p->ClassName() : "",
+                   p ? AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(p->GetEventSpecie())) :"",
+                   p ? ( p->IsDefault() ? "default" : "") : "" ) << endl;
+    }
+    cout << "=========== dumps below ====== " << endl;
+    
+    for ( Int_t i = 0; i <= array->GetLast(); ++i ) 
+    {
+      AliDetectorRecoParam* p = static_cast<AliDetectorRecoParam*>(array->At(i));
+      if ( p ) p->Print("");
+    }
+  }
+  else
+  {
+    o->Print();
+  }
+}