#include "AliMUONClusterFinderVS.h"
#include "AliMUONClusterInput.h"
#include "AliMUONRawCluster.h"
-#include "AliRawReader.h" // for raw data
#include "AliLog.h"
-
-const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0;
-
ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
//__________________________________________________________________________
-AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader)
+ AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader, AliMUONData* data)
: TObject()
{
// Standard Constructor
-
- fDebug = 0;
- fNCh = 0;
- fNTrackingCh = 0;
- fChambers = 0;
- fMUONData = 0;
- fChambers = new TObjArray(AliMUONConstants::NCh());
-
- fPrintLevel = fgkDefaultPrintLevel;
// initialize loader's
fLoader = loader;
// initialize container
- fMUONData = new AliMUONData(fLoader,"MUON","MUON");
+ fMUONData = data;
+
+ // reconstruction model
+ fRecModel = new AliMUONClusterFinderVS();
+ //fRecModel = new AliMUONClusterFinderAZ();
- // Loading AliRun master
- AliRunLoader* runloader = fLoader->GetRunLoader();
- if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
- gAlice = runloader->GetAliRun();
-
- // getting MUON
- fMUON = (AliMUON*) gAlice->GetDetector("MUON");
}
//__________________________________________________________________________
AliMUONClusterReconstructor::AliMUONClusterReconstructor()
: TObject(),
- fNCh(0),
- fNTrackingCh(0),
fMUONData(0),
- fMUON(0),
- fChambers(0),
- fPrintLevel(fgkDefaultPrintLevel),
- fDebug(0),
+ fRecModel(0),
fLoader(0)
{
// Default Constructor
}
-//____________________________________________________________________
-void AliMUONClusterReconstructor::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
-{
- // take infos chambers from AliMUON
- AliMUONChamber* pCh = 0;
- pCh = &(fMUON->Chamber(id));
-
- fChambers->AddAt(pCh, id);
-
- // Set ClusterFinder for chamber id
- ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
-}
//_______________________________________________________________________
AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs)
: TObject(rhs)
//__________________________________________________________________________
AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void)
{
- if (fChambers){
- fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner
- delete fChambers;
- }
- if (fMUONData)
- delete fMUONData;
+
+ if (fRecModel)
+ delete fRecModel;
return;
}
//____________________________________________________________________
-void AliMUONClusterReconstructor::Digits2Clusters()
+void AliMUONClusterReconstructor::Digits2Clusters(Int_t chBeg)
{
-//
-// Perform cluster finding
-//
- TClonesArray *dig1, *dig2;
- Int_t ndig, k;
+
+ TClonesArray *dig1, *dig2, *digAll;
+ Int_t ndig, k, idDE, idDEprev;
dig1 = new TClonesArray("AliMUONDigit",1000);
dig2 = new TClonesArray("AliMUONDigit",1000);
- AliMUONDigit *digit;
-// Loop on chambers and on cathode planes
-//
-// fMUONData->ResetRawClusters();
- TClonesArray * muonDigits;
-
- for (Int_t ich = 0; ich < 10; ich++) {
- AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
- AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
- //AliMUONClusterFinderAZ* rec = (AliMUONClusterFinderAZ*)iChamber->ReconstructionModel();
-
- fMUONData->ResetDigits();
- fMUONData->GetCathode(0);
- //TClonesArray *
- muonDigits = fMUONData->Digits(ich);
- ndig=muonDigits->GetEntriesFast();
- AliDebug(1,Form("1 Found %d digits in %p chamber %d", ndig, (void*)muonDigits,ich));
- TClonesArray &lhits1 = *dig1;
- Int_t n = 0;
- for (k = 0; k < ndig; k++) {
- digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
- if (rec->TestTrack(digit->Track(0)))
- new(lhits1[n++]) AliMUONDigit(*digit);
+ digAll = new TClonesArray("AliMUONDigit",2000);
+
+ AliMUONDigit* digit;
+
+ TArrayI id(200); // contains the different IdDE
+
+
+// Loop on chambers and on cathode planes
+ TClonesArray* muonDigits;
+ Int_t n2;
+ Int_t n1;
+
+ for (Int_t ich = chBeg; ich < AliMUONConstants::NTrackingCh(); ich++) {
+
+ id.Reset();
+ n1 = 0;
+ n2 = 0;
+
+ //cathode 0 & 1
+ muonDigits = fMUONData->Digits(ich);
+ ndig = muonDigits->GetEntriesFast();
+ TClonesArray &lDigit = *digAll;
+
+ idDEprev = 0;
+ muonDigits->Sort();
+ for (k = 0; k < ndig; k++) {
+
+ digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
+ new(lDigit[n1++]) AliMUONDigit(*digit);
+ idDE = digit->DetElemId();
+ if (idDE != idDEprev) {
+ id.AddAt(idDE,n2++);
}
- fMUONData->ResetDigits();
- fMUONData->GetCathode(1);
- muonDigits = fMUONData->Digits(ich);
- ndig=muonDigits->GetEntriesFast();
- AliDebug(1,Form("2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich));
+ idDEprev = idDE;
+ }
+
+ Int_t idSize = n2;
+
+ // loop over id DE
+ for (idDE = 0; idDE < idSize; idDE++) {
+ TClonesArray &lhits1 = *dig1;
TClonesArray &lhits2 = *dig2;
- n=0;
-
- for (k=0; k<ndig; k++) {
- digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
- if (rec->TestTrack(digit->Track(0)))
- new(lhits2[n++]) AliMUONDigit(*digit);
+ dig1->Clear();
+ dig2->Clear();
+ n1 = n2 = 0;
+
+ for (k = 0; k < digAll->GetEntriesFast(); k++) {
+ digit = (AliMUONDigit*) digAll->UncheckedAt(k);
+ // printf("digit idDE %d\n", digit->DetElemId());
+ if (id[idDE] == digit->DetElemId()) {
+ if (digit->Cathode() == 0)
+ new(lhits1[n1++]) AliMUONDigit(*digit);
+ else
+ new(lhits2[n2++]) AliMUONDigit(*digit);
+ }
}
- if (rec) {
- AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
- rec->FindRawClusters();
+ // cluster finder
+ if (fRecModel) {
+ AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2);
+ fRecModel->FindRawClusters();
}
// copy into the container
- TClonesArray* tmp = rec->GetRawClusters();
+ TClonesArray* tmp = fRecModel->GetRawClusters();
for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) {
AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id);
fMUONData->AddRawCluster(ich, *pClus);
}
dig1->Delete();
dig2->Delete();
+ } // idDE
+ digAll->Delete();
} // for ich
delete dig1;
delete dig2;
+ delete digAll;
}
-//____________________________________________________________________
-void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/)
+//_______________________________________________________________________
+void AliMUONClusterReconstructor::Trigger2Trigger()
{
+// copy trigger from TreeD to TreeR
-// Perform cluster finding form raw data
-
- AliFatal("clusterization not implemented for raw data input");
+ fMUONData->SetTreeAddress("GLT");
+ fMUONData->GetTriggerD();
}