]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONData.cxx
From Artur:
[u/mrichter/AliRoot.git] / MUON / AliMUONData.cxx
index dd02c28191633f17c02cca826219a4783242a491..9bd25ad095796548e827331f8187778a83cfb036 100644 (file)
@@ -32,6 +32,7 @@
 #include "AliMUONRawCluster.h"
 #include "AliMUONTrack.h"
 #include "AliMUONTriggerTrack.h"
+#include "AliLog.h"
 
 ClassImp(AliMUONData)
  
@@ -112,7 +113,7 @@ AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
 {
 // Protected copy constructor
 
-  Fatal("AliMUONData", "Not implemented.");
+  AliFatal("Not implemented.");
 }
 
 //_____________________________________________________________________________
@@ -161,7 +162,7 @@ AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
 
   if (this == &rhs) return *this;
 
-  Fatal("operator=", "Not implemented.");
+  AliFatal("Not implemented.");
     
   return *this;  
 }    
@@ -221,21 +222,23 @@ void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
   TClonesArray &globalTrigger = *fGlobalTrigger;
   new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
 }
-//_____________________________________________________________________________
+//____________________________________________________________________________
 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, 
                         Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
                         Float_t tof, Float_t momentum, Float_t theta, 
-                        Float_t phi, Float_t length, Float_t destep)
+                        Float_t phi, Float_t length, Float_t destep,
+                        Float_t Xref,Float_t Yref,Float_t Zref)
 {
 // Add new hit to the hit list
+ // Add new hit to the hit list
   TClonesArray &lhits = *fHits;
   new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, 
                                  idpart, X, Y, Z, 
                                  tof, momentum, theta, 
-                                 phi, length, destep);
+                                 phi, length, destep,
+                                 Xref,Yref,Zref);
 }
 //____________________________________________________________________________
-void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber
+void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId
                         Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
                         Float_t tof, Float_t momentum, Float_t theta, 
                         Float_t phi, Float_t length, Float_t destep,
@@ -243,24 +246,18 @@ void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
 {
  // Add new hit to the hit list
   TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber
+  new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId
                                  idpart, X, Y, Z, 
                                  tof, momentum, theta, 
                                  phi, length, destep,
-                                 Xref,Yref,Zref);
-}
-//____________________________________________________________________________
-void AliMUONData::AddHit(const AliMUONHit& hit)
-{
-  TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliMUONHit(hit);
+                                 Xref,Yref,Zref, true);
 }
 //____________________________________________________________________________
-void AliMUONData::AddLocalTrigger(Int_t *localtr)
+void AliMUONData::AddLocalTrigger(const Int_t *localtr, const TArrayI& digits)
 {
   // add a MUON Local Trigger to the list
   TClonesArray &localTrigger = *fLocalTrigger;
-  new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
+  new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr, digits);
 }
 //____________________________________________________________________________
 void AliMUONData::AddLocalTrigger(const  AliMUONLocalTrigger& trigger)
@@ -322,7 +319,7 @@ Bool_t   AliMUONData::IsRawClusterBranchesInTree()
 {
   // Checking if there are RawCluster Branches In TreeR
   if (TreeR()==0x0) {
-    Error("TreeR","No treeR in memory");
+    AliError("No treeR in memory");
     return kFALSE;
   }
   else {
@@ -339,7 +336,7 @@ Bool_t   AliMUONData::IsDigitsBranchesInTree()
 {
   // Checking if there are RawCluster Branches In TreeR
   if (TreeD()==0x0) {
-    Error("TreeD","No treeD in memory");
+    AliError("No treeD in memory");
     return kFALSE;
   }
   else {
@@ -356,7 +353,7 @@ Bool_t   AliMUONData::IsTriggerBranchesInTree()
 {
   // Checking if there are Trigger Branches In TreeR
  if (TreeR()==0x0) {
-    Error("TreeR","No treeR in memory");
+    AliError("No treeR in memory");
     return kFALSE;
   }
   else {
@@ -373,7 +370,7 @@ Bool_t   AliMUONData::IsTriggerBranchesInTreeD()
 {
   // Checking if there are Trigger Branches In TreeR
  if (TreeD()==0x0) {
-    Error("TreeD","No treeD in memory");
+    AliError("No treeD in memory");
     return kFALSE;
   }
   else {
@@ -391,7 +388,7 @@ Bool_t   AliMUONData::IsTrackBranchesInTree()
 {
   // Checking if there are Track Branches In TreeT
   if (TreeT()==0x0) {
-    Error("TreeT","No treeT in memory");
+    AliError("No treeT in memory");
     return kFALSE;
   }
   else {
@@ -408,7 +405,7 @@ Bool_t   AliMUONData::IsTriggerTrackBranchesInTree()
 {
   // Checking if there are TriggerTrack Branches In TreeT
   if (TreeT()==0x0) {
-    Error("TreeT","No treeT in memory");
+    AliError("No treeT in memory");
     return kFALSE;
   }
   else {
@@ -561,7 +558,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     sprintf(branchname,"%sHits",GetName());  
     branch = TreeH()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch %s is already in tree.",GetName());
+      AliInfo(Form("MakeBranch","Branch %s is already in tree.",GetName()));
       return ;
     }
     branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
@@ -590,7 +587,7 @@ void AliMUONData::MakeBranch(Option_t* option)
       branch = 0x0;
       branch = TreeD()->GetBranch(branchname);
       if (branch) {  
-       Info("MakeBranch","Branch %s is already in tree.",GetName());
+       AliInfo(Form("Branch %s is already in tree.",GetName()));
        return;
       }
       TClonesArray * digits = Digits(iDetectionPlane); 
@@ -612,7 +609,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     }
     branch = TreeD()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch GlobalTrigger is already in treeD.");
+      AliInfo(Form("Branch GlobalTrigger is already in treeD."));
       return ;
     }
     branch = TreeD()->Branch(branchname, &fGlobalTrigger, kBufferSize);
@@ -630,7 +627,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     }
     branch = TreeD()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch LocalTrigger is already in treeD.");
+      AliInfo(Form("Branch LocalTrigger is already in treeD."));
       return;
     }
     branch = TreeD()->Branch(branchname, &fLocalTrigger, kBufferSize);
@@ -660,7 +657,7 @@ void AliMUONData::MakeBranch(Option_t* option)
       branch = 0x0;
       branch = TreeS()->GetBranch(branchname);
       if (branch) {  
-       Info("MakeBranch","Branch %s is already in tree.",GetName());
+       AliInfo(Form("Branch %s is already in tree.",GetName()));
        return;
       }
       TClonesArray * sdigits = SDigits(iDetectionPlane); 
@@ -694,7 +691,7 @@ void AliMUONData::MakeBranch(Option_t* option)
       branch = 0x0;
       branch = TreeR()->GetBranch(branchname);
       if (branch) {  
-       Info("MakeBranch","Branch %s is already in tree.",GetName());
+       AliInfo(Form("Branch %s is already in tree.",GetName()));
        return;
       }
       branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
@@ -715,7 +712,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     }
     branch = TreeR()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch GlobalTrigger is already in treeR.");
+      AliInfo(Form("Branch GlobalTrigger is already in treeR."));
       return ;
     }
     branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
@@ -733,7 +730,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     }
     branch = TreeR()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch LocalTrigger is already in treeR.");
+      AliInfo(Form("Branch LocalTrigger is already in treeR."));
       return;
     }
     branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
@@ -746,7 +743,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     sprintf(branchname,"%sTrack",GetName());  
     branch = TreeT()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch %s is already in tree.",GetName());
+      AliInfo(Form("Branch %s is already in tree.",GetName()));
       return ;
     }
     branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
@@ -759,7 +756,7 @@ void AliMUONData::MakeBranch(Option_t* option)
     sprintf(branchname,"%sTriggerTrack",GetName());  
     branch = TreeT()->GetBranch(branchname);
     if (branch) {  
-      Info("MakeBranch","Branch %s is already in tree.",GetName());
+      AliInfo(Form("Branch %s is already in tree.",GetName()));
       return ;
     }
     branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
@@ -848,14 +845,14 @@ void AliMUONData::ResetRecTracks()
 {
   // Reset tracks information
   fNrectracks = 0;
-  if (fRecTracks) fRecTracks->Clear();
+  if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
 }
 //____________________________________________________________________________
 void AliMUONData::ResetRecTriggerTracks()
 {
   // Reset tracks information
   fNrectriggertracks = 0;
-  if (fRecTriggerTracks) fRecTriggerTracks->Clear();
+  if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
 }
 //_____________________________________________________________________________
 void AliMUONData::SetTreeAddress(Option_t* option)
@@ -893,7 +890,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
       branch->SetAddress(&fHits);
     }
     else { //can be invoked before branch creation
-      Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
+      AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
     }
   }
   
@@ -925,7 +922,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
        if (branch) {
          branch->SetAddress( &digits );
        }
-       else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
+       else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
       }
     }
   }
@@ -933,13 +930,13 @@ void AliMUONData::SetTreeAddress(Option_t* option)
     sprintf(branchname,"%sLocalTrigger",GetName());
     branch = TreeD()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fLocalTrigger);
-    else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName());
+    else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
   }
   if ( TreeD() && fGlobalTrigger && cGLT) {
     sprintf(branchname,"%sGlobalTrigger",GetName());
     branch = TreeD()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fGlobalTrigger);
-    else Warning("SetTreeAddress","(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName());
+    else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
   }
 
   //
@@ -962,7 +959,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
        branch = TreeS()->GetBranch(branchname);
        TClonesArray * sdigits = SDigits(i);
        if (branch) branch->SetAddress( &sdigits );
-       else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
+       else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
       }
     }
   }
@@ -992,7 +989,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
       if (fRawClusters) {
        branch = TreeR()->GetBranch(branchname);
        if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
-       else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
+       else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
       }
     }
   }
@@ -1000,13 +997,13 @@ void AliMUONData::SetTreeAddress(Option_t* option)
     sprintf(branchname,"%sLocalTrigger",GetName());
     branch = TreeR()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fLocalTrigger);
-    else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName());
+    else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
   }
   if ( TreeR() && fGlobalTrigger && cTC) {
     sprintf(branchname,"%sGlobalTrigger",GetName());
     branch = TreeR()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fGlobalTrigger);
-    else Warning("SetTreeAddress","(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName());
+    else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
   }
 
   if ( TreeT() ) {
@@ -1019,7 +1016,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
     sprintf(branchname,"%sTrack",GetName());  
     branch = TreeT()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fRecTracks);
-    else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
+    else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
   }
 // trigger tracks
   if ( TreeT() ) {
@@ -1032,7 +1029,7 @@ void AliMUONData::SetTreeAddress(Option_t* option)
     sprintf(branchname,"%sTriggerTrack",GetName());  
     branch = TreeT()->GetBranch(branchname);
     if (branch) branch->SetAddress(&fRecTriggerTracks);
-    else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
+    else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
   }