Changes due to removal of AliMUONSim/RecData (Laurent)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:25:19 +0000 (20:25 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:25:19 +0000 (20:25 +0000)
EVE/Alieve/MUONChamberData.cxx
EVE/Alieve/MUONChamberData.h
EVE/Alieve/MUONData.cxx
EVE/Alieve/MUONData.h
HLT/MUON/OfflineInterface/AliHLTMUONRecHitsSource.cxx
HLT/MUON/OfflineInterface/AliHLTMUONRecHitsSource.h

index 9a84303778fc632b02257365fe874156ddee7bc1..71f8385114008b7f1daa9a5413cf254252e2a336 100644 (file)
@@ -1,8 +1,6 @@
 #include "MUONChamberData.h"
 
-#include <AliMUONSegmentation.h>
 #include <AliMUONGeometryTransformer.h>
-#include <AliMUONSegFactory.h>
 #include <mapping/AliMpDEIterator.h>
 #include <mapping/AliMpSectorSegmentation.h>
 #include <mapping/AliMpSector.h>
@@ -29,7 +27,6 @@ using namespace Alieve;
 
 ClassImp(MUONChamberData)
 
-AliMUONSegmentation* MUONChamberData::fgSegmentation = 0;
 AliMUONGeometryTransformer* MUONChamberData::fgTransformer = 0;
 
 //______________________________________________________________________
@@ -70,9 +67,7 @@ MUONChamberData::MUONChamberData(Int_t chamber)
     fChamberBox[i*2+1] = -9999;
   }
 
-  if (fgSegmentation == 0) {
-    AliMUONSegFactory segFactory("volpath.dat","transform.dat");
-    fgSegmentation = segFactory.CreateSegmentation();
+  if (fgTransformer == 0) {
     fgTransformer = new AliMUONGeometryTransformer(true);
     fgTransformer->ReadGeometryData("volpath.dat",dataPath.Data());
   }
@@ -165,10 +160,10 @@ void MUONChamberData::Init(Int_t chamber)
     
     } else {
 
-      if (!fgSegmentation->HasDE(detElemId)) {
-       printf("Segmentation has no %d detElemId! \n",detElemId);
-       continue;
-      }
+//      if (!fgSegmentation->HasDE(detElemId)) {
+//     printf("Segmentation has no %d detElemId! \n",detElemId);
+//     continue;
+//      }
 
       vseg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0);
 
index 3872e752de89b40191a51e08b1fce1a02b1fae3d..aa78d387c2e23d6be0424cb7835e66b5a882f411 100644 (file)
@@ -5,7 +5,6 @@
 
 #include <TObject.h>
 
-class AliMUONSegmentation;
 class AliMUONGeometryTransformer;
 
 namespace Alieve {
@@ -18,7 +17,6 @@ class MUONChamberData : public TObject
 
 private:
 
-  static AliMUONSegmentation*        fgSegmentation;  // detector segmentation
   static AliMUONGeometryTransformer* fgTransformer;   // geometry transformer
 
 protected:
index e0a23963ef4ba4116078de46035b9417783c51be..21d42bf97c89334672a07a83ec7d4919d82aa208 100644 (file)
 #include <AliMUONDigitMaker.h>
 #include <AliMUONHit.h>
 #include <AliMUONRawCluster.h>
-#include <AliMUONDigit.h>
+#include <AliMUONVDigit.h>
 #include <AliMUONTriggerCrateStore.h>
-#include <AliMUONData.h>
-
+#include "AliMUONDigitStoreV1.h"
 #include "TTree.h"
 #include "TString.h"
 #include "TClonesArray.h"
@@ -90,7 +89,9 @@ void MUONData::Reset()
 //______________________________________________________________________
 MUONData::MUONData(const MUONData &mdata) :
   TObject(mdata),
-  Reve::ReferenceCount()
+  Reve::ReferenceCount(),
+  fChambers(14),
+  fNTrackList(0)
 {
   //
   // Copy constructor
@@ -195,45 +196,6 @@ void MUONData::RegisterTrack(Int_t track)
 
 }
 
-//______________________________________________________________________
-void MUONData::LoadDigits(TTree* tree)
-{
-  // 
-  // load digits from the TreeD
-  //
-
-  Char_t branchname[30];
-  TClonesArray *digits = 0;
-  Int_t ndigits;
-  AliMUONDigit  *mdig;
-  Int_t cathode, detElemId, ix, iy, charge;
-
-  for (Int_t c = 0; c < 14; ++c) {
-
-    if (fChambers[c] == 0) continue;
-    sprintf(branchname,"MUONDigits%d",c+1);
-    tree->SetBranchAddress(branchname,&digits);
-    tree->GetEntry(0);
-
-    ndigits = digits->GetEntriesFast(); 
-
-    for (Int_t id = 0; id < ndigits; id++) {
-      mdig  = (AliMUONDigit*)digits->UncheckedAt(id);
-
-      cathode   = mdig->Cathode();
-      ix        = mdig->PadX();
-      iy        = mdig->PadY();
-      detElemId = mdig->DetElemId();      
-      charge    = (Int_t)mdig->Signal();
-
-      fChambers[c]->RegisterDigit(detElemId,cathode,ix,iy,charge);
-      
-    } // end digits loop
-
-  }
-
-}
-
 //______________________________________________________________________
 void MUONData::LoadRecPoints(TTree* tree)
 {
@@ -337,48 +299,43 @@ void MUONData::LoadRaw(TString fileName)
   fgRawReader->Reset();
 
   Int_t iEvent = 0;
-  while (fgRawReader->NextEvent()) {
-    if (iEvent != Alieve::gEvent->GetEventId()) {
+  while (fgRawReader->NextEvent()) 
+  {
+    if (iEvent != Alieve::gEvent->GetEventId()) 
+    {
       iEvent++;
       continue;
     }
     break;
   }
 
-  AliMUONDigitMaker *digitMaker = new AliMUONDigitMaker();
+  AliMUONDigitMaker digitMaker;
 
-  AliMUONTriggerCrateStore *crateManager = new AliMUONTriggerCrateStore();
-  crateManager->ReadFromFile();
+  AliMUONTriggerCrateStore crateManager;
+  crateManager.ReadFromFile();
 
-  AliMUONData *muonData = new AliMUONData(0x0,"MUON","MUON");
+  digitMaker.SetMakeTriggerDigits(kTRUE);
+  digitMaker.SetCrateManager(&crateManager);
 
-  digitMaker->SetDisplayFlag();
-  digitMaker->SetCrateManager(crateManager);
-  digitMaker->SetMUONData(muonData);
-  muonData->SetDataContainer("D, GLT");
-
-  digitMaker->Raw2Digits(fgRawReader);
+  AliMUONDigitStoreV1 digitStore;
+  
+  digitMaker.Raw2Digits(fgRawReader,&digitStore);
 
-  AliMUONDigit *digit;
-  Int_t cathode, detElemId, ix, iy, charge, chamber, ndigits;
-  for (chamber = 0; chamber < 14; chamber++) {
-    ndigits = (Int_t)muonData->Digits(chamber)->GetEntriesFast();
-    for (Int_t id = 0; id < ndigits; id++) {
-      digit = static_cast<AliMUONDigit*>(muonData->Digits(chamber)->At(id));
+  AliMUONVDigit* digit;
+  TIter next(digitStore.CreateIterator());
+  
+  Int_t cathode, detElemId, ix, iy, charge, chamber;
+  
+  while ( ( digit = static_cast<AliMUONVDigit*>(next() ) ) )
+  {
       cathode   = digit->Cathode();
       ix        = digit->PadX();
       iy        = digit->PadY();
       detElemId = digit->DetElemId();      
-      charge    = (Int_t)digit->Signal();
+      charge    = (Int_t)digit->Charge();
       chamber   = detElemId/100 - 1;
       fChambers[chamber]->RegisterDigit(detElemId,cathode,ix,iy,charge);
-    }
   }
-
-  delete muonData;
-  delete crateManager;
-  delete digitMaker;
-
 }
 
 //______________________________________________________________________
index 41f64d293d19d3b4609fda6165e3bc1990be05e8..ecd4fa95297051069703cc4bb6a99c2fedbbc348 100644 (file)
@@ -38,7 +38,6 @@ class MUONData : public TObject, public Reve::ReferenceCount
 
   void Reset();
 
-  void LoadDigits(TTree* tree);
   void LoadRecPoints(TTree* tree);
   void LoadHits(TTree* tree);
   void LoadRaw(TString fileName);
index 08bac79ee86a3740359a1abdc5a32cb9c568589c..f37dda412d5b12c36b6bfadf6d5d9d199fa837d4 100644 (file)
 #include "AliHLTMUONRecHitsSource.h"
 #include "AliHLTMUONConstants.h"
 #include "AliHLTMUONDataBlockWriter.h"
-#include "AliMUONSimData.h"
-#include "AliMUONRecData.h"
+#include "AliMUONMCDataInterface.h"
+#include "AliMUONDataInterface.h"
 #include "AliMUONHit.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONConstants.h"
-#include "AliRunLoader.h"
-#include "AliLoader.h"
+#include "AliMUONVClusterStore.h"
+#include "AliMUONVHitStore.h"
 #include "TClonesArray.h"
 #include <cstdlib>
 #include <cstdio>
@@ -52,8 +52,7 @@ ClassImp(AliHLTMUONRecHitsSource);
 
 AliHLTMUONRecHitsSource::AliHLTMUONRecHitsSource() :
        AliHLTOfflineDataSource(),
-       fSimData(NULL), fRecData(NULL),
-       fRunLoader(NULL), fLoader(NULL),
+       fMCDataInterface(NULL), fDataInterface(NULL),
        fSelection(kWholePlane)
 {
        for (Int_t i = 0; i < AliMUONConstants::NTrackingCh(); i++)
@@ -63,10 +62,8 @@ AliHLTMUONRecHitsSource::AliHLTMUONRecHitsSource() :
 
 AliHLTMUONRecHitsSource::~AliHLTMUONRecHitsSource()
 {
-       assert( fSimData == NULL );
-       assert( fRecData == NULL );
-       assert( fRunLoader == NULL );
-       assert( fLoader == NULL );
+       assert( fMCDataInterface == NULL );
+       assert( fDataInterface == NULL );
 }
 
 
@@ -189,19 +186,17 @@ int AliHLTMUONRecHitsSource::DoInit(int argc, const char** argv)
                
                try
                {
-                       fSimData = new AliMUONSimData("galice.root");
+                       fMCDataInterface = new AliMUONMCDataInterface("galice.root");
                }
                catch (const std::bad_alloc&)
                {
                        Logging(kHLTLogError,
                                "AliHLTMUONRecHitsSource::DoInit",
                                "Out of memory",
-                               "Not enough memory to allocate AliMUONSimData."
+                               "Not enough memory to allocate AliMUONMCDataInterface."
                        );
                        return ENOMEM;
                }
-               fLoader = fSimData->GetLoader();
-               fLoader->LoadHits("READ");
        }
        else if (recdata)
        {
@@ -213,43 +208,29 @@ int AliHLTMUONRecHitsSource::DoInit(int argc, const char** argv)
                
                try
                {
-                       fRecData = new AliMUONRecData("galice.root");
+                       fDataInterface = new AliMUONDataInterface("galice.root");
                }
                catch (const std::bad_alloc&)
                {
                        Logging(kHLTLogError,
                                "AliHLTMUONRecHitsSource::DoInit",
                                "Out of memory",
-                               "Not enough memory to allocate AliMUONRecData."
+                               "Not enough memory to allocate AliMUONDataInterface."
                        );
                        return ENOMEM;
                }
-               fLoader = fRecData->GetLoader();
-               fLoader->LoadRecPoints("READ");
        }
        
-       fRunLoader = AliRunLoader::GetRunLoader();
-       
        return 0;
 }
 
 
 int AliHLTMUONRecHitsSource::DoDeinit()
 {
-       if (fSimData != NULL)
-       {
-               fLoader->UnloadHits();
-               delete fSimData;
-               fSimData = NULL;
-       }
-       if (fRecData != NULL)
-       {
-               fLoader->UnloadRecPoints();
-               delete fRecData;
-               fRecData = NULL;
-       }
-       fRunLoader = NULL;
-       fLoader = NULL;
+  delete fMCDataInterface;
+  fMCDataInterface = NULL;
+  delete fDataInterface;
+  fDataInterface = NULL;
        return 0;
 }
 
@@ -283,15 +264,13 @@ AliHLTComponent* AliHLTMUONRecHitsSource::Spawn()
 
 int AliHLTMUONRecHitsSource::GetEvent(
                const AliHLTComponentEventData& evtData,
-               AliHLTComponentTriggerData& trigData,
+               AliHLTComponentTriggerData& /*trigData*/,
                AliHLTUInt8_t* outputPtr, 
                AliHLTUInt32_t& size,
                vector<AliHLTComponentBlockData>& outputBlocks
        )
 {
-       assert( fSimData != NULL or fRecData != NULL );
-       assert( fRunLoader != NULL );
-       assert( fLoader != NULL );
+       assert( fMCDataInterface != NULL or fDataInterface != NULL );
 
        // Check the size of the event descriptor structure.
        if (evtData.fStructSize < sizeof(AliHLTComponentEventData))
@@ -312,7 +291,8 @@ int AliHLTMUONRecHitsSource::GetEvent(
        // Use the fEventID as the event number to load, check it and load that
        // event with the runloader.
        UInt_t eventnumber = UInt_t(evtData.fEventID);
-       if ( eventnumber >= UInt_t(fRunLoader->GetNumberOfEvents()) )
+  UInt_t maxevent = UInt_t(fMCDataInterface->NumberOfEvents());
+       if ( eventnumber >= maxevent )
        {
                Logging(kHLTLogError,
                        "AliHLTMUONRecHitsSource::GetEvent",
@@ -320,12 +300,11 @@ int AliHLTMUONRecHitsSource::GetEvent(
                        "The event number (%d) is larger than the available number"
                          " of events on file (%d).",
                        eventnumber,
-                       fRunLoader->GetNumberOfEvents()
-               );
+      maxevent
+    );
                size = 0; // Important to tell framework that nothing was generated.
                return EINVAL;
        }
-       fRunLoader->GetEvent(eventnumber);
        
        // Create and initialise a new data block.
        AliHLTMUONRecHitsBlockWriter block(outputPtr, size);
@@ -343,7 +322,7 @@ int AliHLTMUONRecHitsSource::GetEvent(
                return ENOBUFS;
        }
        
-       if (fSimData != NULL)
+       if (fMCDataInterface != NULL)
        {
                Logging(kHLTLogDebug,
                        "AliHLTMUONRecHitsSource::GetEvent",
@@ -354,18 +333,14 @@ int AliHLTMUONRecHitsSource::GetEvent(
                
                // Loop over all tracks, extract the hits and write them to the
                // data block.
-               fSimData->SetTreeAddress("H");
-               for (Int_t i = 0; i < fSimData->GetNtracks(); i++)
+    Int_t ntracks = fMCDataInterface->NumberOfTracks(eventnumber);
+               for (Int_t i = 0; i < ntracks; ++i)
                {
-                       fSimData->GetTrack(i);
-                       assert( fSimData->Hits() != NULL );
-                       Int_t nhits = fSimData->Hits()->GetEntriesFast();
-                       for (Int_t j = 0; j < nhits; j++)
-                       {
-                               AliMUONHit* hit = static_cast<AliMUONHit*>(
-                                               fSimData->Hits()->At(j)
-                                       );
-                               
+      AliMUONVHitStore* hitStore = fMCDataInterface->HitStore(eventnumber,i);
+      AliMUONHit* hit;
+      TIter next(hitStore->CreateIterator());
+      while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
+      {
                                // Select only hits on selected chambers.
                                Int_t chamber = hit->Chamber() - 1;
                                if (chamber > AliMUONConstants::NTrackingCh()) continue;
@@ -385,7 +360,6 @@ int AliHLTMUONRecHitsSource::GetEvent(
                                                  " We overflowed the buffer which is only %d bytes.",
                                                block.BufferSize()
                                        );
-                                       fSimData->ResetHits();
                                        size = 0; // Important to tell framework that nothing was generated.
                                        return ENOBUFS;
                                }
@@ -394,10 +368,10 @@ int AliHLTMUONRecHitsSource::GetEvent(
                                rechit->fY = hit->Yref();
                                rechit->fZ = hit->Zref();
                        }
-                       fSimData->ResetHits();
+      delete hitStore;
                }
        }
-       else if (fRecData != NULL)
+       else if (fDataInterface != NULL)
        {
                Logging(kHLTLogDebug,
                        "AliHLTMUONRecHitsSource::GetEvent",
@@ -406,21 +380,19 @@ int AliHLTMUONRecHitsSource::GetEvent(
                        eventnumber
                );
                
-               fRecData->SetTreeAddress("RC,TC"); 
-               fRecData->GetRawClusters();
-               
+               AliMUONVClusterStore* clusterStore = fDataInterface->ClusterStore(eventnumber);
+    
                // Loop over selected chambers and extract the raw clusters.
-               for (Long_t chamber = 0; chamber < AliMUONConstants::NTrackingCh(); chamber++)
+               for (Int_t chamber = 0; chamber < AliMUONConstants::NTrackingCh(); chamber++)
                {
                        // Select only hits on selected chambers.
                        if (not fServeChamber[chamber]) continue;
                        
-                       TClonesArray* clusterarray = fRecData->RawClusters(chamber);
-                       Int_t nrecpoints = clusterarray->GetEntriesFast();
-                       for (Int_t i = 0; i < nrecpoints; i++)
-                       {
-                               AliMUONRawCluster* cluster = static_cast<AliMUONRawCluster*>(clusterarray->At(i));
-                               
+      TIter next(clusterStore->CreateChamberIterator(chamber,chamber));
+      AliMUONRawCluster* cluster;
+      
+                       while ( ( cluster = static_cast<AliMUONRawCluster*>(next()) ) )
+      {                                
                                // Only select hits from the given part of the plane
                                if (fSelection == kLeftPlane and not (cluster->GetX() < 0)) continue;
                                if (fSelection == kRightPlane and not (cluster->GetX() >= 0)) continue;
@@ -435,7 +407,6 @@ int AliHLTMUONRecHitsSource::GetEvent(
                                                  " We overflowed the buffer which is only %d bytes.",
                                                block.BufferSize()
                                        );
-                                       fRecData->ResetRawClusters();
                                        size = 0; // Important to tell framework that nothing was generated.
                                        return ENOBUFS;
                                }
@@ -445,8 +416,7 @@ int AliHLTMUONRecHitsSource::GetEvent(
                                rechit->fZ = cluster->GetZ();
                        }
                }
-               
-               fRecData->ResetRawClusters();
+    delete clusterStore;
        }
        else
        {
index 3f4669f5a6b70229bc87dbde635ae58009c542d7..ddd1510ba924ceb6d5e60ef425ce25193041554e 100644 (file)
 
 #include "AliHLTOfflineDataSource.h"
 
-class AliMUONSimData;
-class AliMUONRecData;
-class AliRunLoader;
-class AliLoader;
+class AliMUONMCDataInterface;
+class AliMUONDataInterface;
 
 /**
  * AliHLTMUONRecHitsSource is a HLT-AliRoot data source object which generates
@@ -69,6 +67,9 @@ protected:
        
 private:
 
+  AliMUONMCDataInterface* fMCDataInterface; // access to MUON MC-related data
+  AliMUONDataInterface* fDataInterface; // access to MUON data
+
        enum SelectionType
        {
                kLeftPlane,  // everything from x < 0
@@ -87,10 +88,6 @@ private:
         */
        int ParseChamberString(const char* str);
 
-       AliMUONSimData* fSimData; //! MUON module interface to simulated data.
-       AliMUONRecData* fRecData; //! MUON module interface to reconstructed data.
-       AliRunLoader* fRunLoader; //! A pointer to the AliRunLoader instance.
-       AliLoader* fLoader; //! Pointer to the MUON loader instance.
        SelectionType fSelection; //! Indicates if we should publish from the left, right or whole XY plane.
        bool fServeChamber[10]; //! Flag to indicate if hits from a given chamber should be published.