]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONESDInterface.cxx
Adding 2013 periods
[u/mrichter/AliRoot.git] / MUON / AliMUONESDInterface.cxx
index 87bd127b35b21f4f8ec6a1119876c5b0227d8638..504fa93d38deff8c52e47930439c2690caaf5dd5 100644 (file)
@@ -33,6 +33,7 @@
 #include "AliMUONTracker.h"
 #include "AliMUONRecoParam.h"
 #include "AliMUONVTrackReconstructor.h"
+#include "AliMUONCDB.h"
 
 #include "AliMpExMapIterator.h"
 #include "AliMpVSegmentation.h"
@@ -71,6 +72,8 @@
 /// \author Philippe Pillot
 //-----------------------------------------------------------------------------
 
+using std::endl;
+using std::cout;
 /// \cond CLASSIMP
 ClassImp(AliMUONESDInterface)
 /// \endcond
@@ -433,22 +436,25 @@ TIterator* AliMUONESDInterface::CreateLocalTriggerIterator() const
 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
+  /// If not provided, will get them from OCDB.
+  /// Load the magnetic field from OCDB if not already set.
   
   delete fgTracker;
   delete fgRecoParam;
   
   if (recoParam) {
     
+    // use provided recoParam
     fgRecoParam = new AliMUONRecoParam(*recoParam);
     
-    if (info) cout<<"I-AliMUONESDInterface::ResetTracker: will refit tracks with provided RecoParam:"<<endl;
+    if (info) AliInfoClass("will refit tracks with provided RecoParam:");
     
   } else {
     
-    fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
+    // or get them from OCDB
+    fgRecoParam = AliMUONCDB::LoadRecoParam();
     
-    cout<<"W-AliMUONESDInterface::ResetTracker: RecoParam not provided. Will use default LowFlux parametrization:"<<endl;
+    if (!fgRecoParam) AliFatalClass("RecoParam have not been set!");
     
   }
   
@@ -461,10 +467,11 @@ void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam, Bool_t
     <<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
   }
   
-  if (!TGeoGlobalMagField::Instance()->GetField())
-    cout<<"W-AliMUONESDInterface::ResetTracker: Magnetic field has not been set --> assume field is OFF"<<endl;
+  // load magnetic field for track extrapolation if not already set
+  if (!TGeoGlobalMagField::Instance()->GetField() && !AliMUONCDB::LoadField())
+    AliFatalClass("Magnetic field has not been set!");
   
-  fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0);
+  fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0,0x0);
   
 }
 
@@ -474,7 +481,7 @@ AliMUONVTrackStore* AliMUONESDInterface::NewTrackStore()
   /// Create an empty track store of type fgTrackStoreName
   TClass* classPtr = TClass::GetClass(fgTrackStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVTrackStore")) {
-    cout<<"E-AliMUONESDInterface::NewTrackStore: Unable to create store of type "<<fgTrackStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgTrackStoreName.Data()));
     return 0x0;
   }
   return reinterpret_cast<AliMUONVTrackStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTrackStoreName.Data())));
@@ -486,7 +493,7 @@ AliMUONVClusterStore* AliMUONESDInterface::NewClusterStore()
   /// Create an empty cluster store of type fgClusterStoreName
   TClass* classPtr = TClass::GetClass(fgClusterStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVClusterStore")) {
-    cout<<"E-AliMUONESDInterface::NewClusterStore: Unable to create store of type "<<fgClusterStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgClusterStoreName.Data()));
     return 0x0;
   }
   return reinterpret_cast<AliMUONVClusterStore*>(gROOT->ProcessLineFast(Form("new %s()",fgClusterStoreName.Data())));
@@ -498,7 +505,7 @@ AliMUONVCluster* AliMUONESDInterface::NewCluster()
   /// Create an empty cluster of type associated to the cluster store of type fgClusterStoreName
   TClass* classPtr = TClass::GetClass(fgClusterStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVClusterStore")) {
-    cout<<"E-AliMUONESDInterface::NewCluster: Unable to create store of type "<<fgClusterStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgClusterStoreName.Data()));
     return 0x0;
   }
   AliMUONVClusterStore* cStore = reinterpret_cast<AliMUONVClusterStore*>(classPtr->New());
@@ -513,7 +520,7 @@ AliMUONVDigitStore* AliMUONESDInterface::NewDigitStore()
   /// Create an empty digit store of type fgDigitStoreName
   TClass* classPtr = TClass::GetClass(fgDigitStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore")) {
-    cout<<"E-AliMUONESDInterface::NewDigitStore: Unable to create store of type "<<fgDigitStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgDigitStoreName.Data()));
     return 0x0;
   }
   return reinterpret_cast<AliMUONVDigitStore*>(gROOT->ProcessLineFast(Form("new %s()",fgDigitStoreName.Data())));
@@ -525,7 +532,7 @@ AliMUONVDigit* AliMUONESDInterface::NewDigit()
   /// Create an empty digit of type associated to the digit store of type fgDigitStoreName
   TClass* classPtr = TClass::GetClass(fgDigitStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore")) {
-    cout<<"E-AliMUONESDInterface::NewDigitStore: Unable to create store of type "<<fgDigitStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgDigitStoreName.Data()));
     return 0x0;
   }
   AliMUONVDigitStore* dStore = reinterpret_cast<AliMUONVDigitStore*>(classPtr->New());
@@ -540,7 +547,7 @@ AliMUONVTriggerStore* AliMUONESDInterface::NewTriggerStore()
   /// Create an empty trigger store of type fgTriggerStoreName
   TClass* classPtr = TClass::GetClass(fgTriggerStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVTriggerStore")) {
-    cout<<"E-AliMUONESDInterface::NewTriggerStore: Unable to create store of type "<<fgTriggerStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgTriggerStoreName.Data()));
     return 0x0;
   }
   return reinterpret_cast<AliMUONVTriggerStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTriggerStoreName.Data())));
@@ -552,7 +559,7 @@ AliMUONVTriggerTrackStore* AliMUONESDInterface::NewTriggerTrackStore()
   /// Create an empty trigger track store of type fgTriggerTrackStoreName
   TClass* classPtr = TClass::GetClass(fgTriggerTrackStoreName);
   if (!classPtr || !classPtr->InheritsFrom("AliMUONVTriggerTrackStore")) {
-    cout<<"E-AliMUONESDInterface::NewTriggerTrackStore: Unable to create store of type "<<fgTriggerTrackStoreName.Data()<<endl;
+    AliErrorClass(Form("Unable to create store of type %s", fgTriggerTrackStoreName.Data()));
     return 0x0;
   }
   return reinterpret_cast<AliMUONVTriggerTrackStore*>(gROOT->ProcessLineFast(Form("new %s()",fgTriggerTrackStoreName.Data())));
@@ -717,6 +724,7 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrac
   track.SetMatchTrigger(esdTrack.GetMatchTrigger());
   track.SetChi2MatchTrigger(esdTrack.GetChi2MatchTrigger());
   track.SetHitsPatternInTrigCh(esdTrack.GetHitsPatternInTrigCh());
+  track.SetHitsPatternInTrigChTrk(esdTrack.GetHitsPatternInTrigChTrk());
   track.SetLocalTrigger(esdTrack.LoCircuit(), esdTrack.LoStripX(), esdTrack.LoStripY(),
                        esdTrack.LoDev(), esdTrack.LoLpt(), esdTrack.LoHpt(),
                        esdTrack.GetTriggerWithoutChamber());
@@ -746,7 +754,7 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrac
       AliESDMuonCluster *esdCluster = esdTrack.GetESDEvent()->FindMuonCluster(esdTrack.GetClusterId(i));
       if (esdCluster) clusterFound = kTRUE;
       else {
-       cout<<"E-AliMUONESDInterface::ESDToMUON: a cluster is missing in ESD"<<endl;
+       AliErrorClass("a cluster is missing in ESD");
        continue;
       }
       
@@ -807,12 +815,12 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLoca
 {
   /// Transfert trigger data from ESDMuon track to the MUONLocalTtrigger object
   
-  // if the ESDMuon track is a ghost then return an empty MUON track
-  if (!esdTrack.ContainTriggerData()) {
-    AliMUONLocalTrigger emptyLocTrg;
-    locTrg = emptyLocTrg;
-    return;
-  }
+  // reset the local trigger content
+  AliMUONLocalTrigger emptyLocTrg;
+  locTrg = emptyLocTrg;
+  
+  // if the ESDMuon track is a ghost then return an empty local trigger
+  if (!esdTrack.ContainTriggerData()) return;
   
   locTrg.SetUniqueID(esdTrack.GetUniqueID());
   locTrg.SetLoCircuit(esdTrack.LoCircuit());
@@ -821,8 +829,10 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLoca
   locTrg.SetDeviation(esdTrack.LoDev());
   locTrg.SetLoLpt(esdTrack.LoLpt());
   locTrg.SetLoHpt(esdTrack.LoHpt());
-  locTrg.SetTriggerWithoutChamber(esdTrack.GetTriggerWithoutChamber());
-  locTrg.SetLoTrigY(1);
+  for (Int_t ich = 0; ich < 4; ich++)
+    if (esdTrack.TriggerFiredWithoutChamber(ich))
+      locTrg.SetTriggerWithoutChamber(ich);
+  locTrg.SetLoTrigY(0);
   locTrg.SetX1Pattern(esdTrack.GetTriggerX1Pattern());
   locTrg.SetX2Pattern(esdTrack.GetTriggerX2Pattern());
   locTrg.SetX3Pattern(esdTrack.GetTriggerX3Pattern());
@@ -856,11 +866,10 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUON
 void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit)
 {
   /// Transfert data from ESDMuon pad to MUON digit
+  /// Load mapping from OCDB if not already set
   
-  if (!AliMpSegmentation::Instance(kFALSE)) {
-    cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
-    return;
-  }
+  if (!AliMpSegmentation::Instance(kFALSE) && !AliMUONCDB::LoadMapping(kTRUE))
+    AliFatalClass("mapping segmentation has not been set!");
   
   const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());  
   AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
@@ -958,6 +967,7 @@ void AliMUONESDInterface::MUONToESD(const AliMUONTrack& track, AliESDMuonTrack&
   esdTrack.SetLocalTrigger(track.GetLocalTrigger());
   esdTrack.SetChi2MatchTrigger(track.GetChi2MatchTrigger());
   esdTrack.SetHitsPatternInTrigCh(track.GetHitsPatternInTrigCh());
+  esdTrack.SetHitsPatternInTrigChTrk(track.GetHitsPatternInTrigChTrk());
   if (locTrg) {
     esdTrack.SetTriggerX1Pattern(locTrg->GetX1Pattern());
     esdTrack.SetTriggerY1Pattern(locTrg->GetY1Pattern());
@@ -1018,6 +1028,7 @@ void AliMUONESDInterface::MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuo
   esdTrack.SetTriggerX4Pattern(locTrg.GetX4Pattern());
   esdTrack.SetTriggerY4Pattern(locTrg.GetY4Pattern());
   UShort_t hitPattern = 0;
+  esdTrack.SetHitsPatternInTrigChTrk(hitPattern);
   if(triggerTrack){
     hitPattern = triggerTrack->GetHitsPatternInTrigCh();
     esdTrack.SetHitsPatternInTrigCh(hitPattern);
@@ -1046,7 +1057,7 @@ void AliMUONESDInterface::MUONToESD(const AliMUONVCluster& cluster, AliESDEvent&
     for (Int_t i=0; i<cluster.GetNDigits(); i++) {
       AliMUONVDigit* digit = digits->FindObject(cluster.GetDigitId(i));
       if (!digit) {
-       cout<<"E-AliMUONESDInterface::MUONToESD: digit "<<cluster.GetDigitId(i)<<" not found"<<endl;
+       AliErrorClass(Form("digit %u not found", cluster.GetDigitId(i)));
        continue;
       }
       MUONToESD(*digit, esd);