X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONClusterReconstructor.cxx;h=5640422e6a4144e4b2b38a050453aab7f2d1a0be;hb=86344f32445f746f5093ecf2a6fd968b69f7b04d;hp=9395478341cf92c10776717bb1093253ba4e6a63;hpb=e516b01dc9b050949d85a6e082e9213ee783c82c;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONClusterReconstructor.cxx b/MUON/AliMUONClusterReconstructor.cxx index 9395478341c..5640422e6a4 100644 --- a/MUON/AliMUONClusterReconstructor.cxx +++ b/MUON/AliMUONClusterReconstructor.cxx @@ -15,195 +15,147 @@ /* $Id$ */ -//////////////////////////////////// -// -// MUON cluster reconstructor for MUON -// -// Should implement a virtual class ClusterFinder to chose between VS and AZ method -//////////////////////////////////// +/// \class AliMUONClusterReconstructor +/// +/// This class is just a steering class to loop over detection elements of tracking chambers, +/// extract the relevant digits, and pass them to the actual clusterizer class, +/// which operate on a single detection element at a time. +/// +/// \author C. Finck and L. Aphecetche, Subatech +/// #include "AliMUONClusterReconstructor.h" -#include "AliRun.h" // for gAlice -#include "AliRunLoader.h" -#include "AliLoader.h" -#include "AliMUON.h" -#include "AliMUONDigit.h" -#include "AliMUONConstants.h" -#include "AliMUONData.h" -#include "AliMUONClusterFinderVS.h" -#include "AliMUONClusterInput.h" +#include "AliLog.h" +#include "AliMUONCluster.h" +#include "AliMUONGeometryTransformer.h" #include "AliMUONRawCluster.h" -#include "AliRawReader.h" // for raw data - - -const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0; - +#include "AliMUONVClusterFinder.h" +#include "AliMUONVClusterStore.h" +#include "AliMUONVDigit.h" +#include "AliMUONVDigitStore.h" +#include "AliMpDEIterator.h" +#include "AliMpDEManager.h" +#include "AliMpSegmentation.h" +#include + +/// \cond CLASSIMP ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context - -//__________________________________________________________________________ -AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader) - : TObject() -{ - // Standard Constructor +/// \endcond - 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"); - - // 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), - 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(AliMUONVClusterFinder* clusterFinder, + const AliMUONGeometryTransformer* transformer) +: TObject(), + fClusterFinder(clusterFinder), + fTransformer(transformer), + fClusterStore(0x0) { -// Protected copy constructor - - Fatal("AliMUONClusterReconstructor", "Not implemented."); -} - -//_______________________________________________________________________ -AliMUONClusterReconstructor & -AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs) -{ -// Protected assignement operator - - if (this == &rhs) return *this; - - Fatal("operator=", "Not implemented."); - - return *this; + /// Standard Constructor + + if (!transformer && clusterFinder) + { + AliFatal("I require a geometry transformer, otherwise I cannot compute " + "global coordinates of the clusters !"); + } + +// fRecModel->SetGhostChi2Cut(10); } //__________________________________________________________________________ AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void) { - if (fChambers){ - fChambers->Clear(); // Sets pointers to 0 sinche it is not the owner - delete fChambers; - } - if (fMUONData) - delete fMUONData; - - return; + /// Destructor } -//____________________________________________________________________ -void AliMUONClusterReconstructor::Digits2Clusters() -{ -// -// Perform cluster finding -// - TClonesArray *dig1, *dig2; - Int_t ndig, k; - 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(); - if(fDebug) - printf("1 Found %d digits in %p chamber %d\n", 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); - } - fMUONData->ResetDigits(); - fMUONData->GetCathode(1); - muonDigits = fMUONData->Digits(ich); - ndig=muonDigits->GetEntriesFast(); - if(fDebug) - printf("\n 2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich); - TClonesArray &lhits2 = *dig2; - n=0; - - for (k=0; kUncheckedAt(k); - if (rec->TestTrack(digit->Track(0))) - new(lhits2[n++]) AliMUONDigit(*digit); - } - - if (rec) { - AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); - rec->FindRawClusters(); - } - // copy into the container - TClonesArray* tmp = rec->GetRawClusters(); - for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) { - AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); - fMUONData->AddRawCluster(ich, *pClus); - } - dig1->Delete(); - dig2->Delete(); - } // for ich - delete dig1; - delete dig2; +//______________________________________________________________________________ +void +AliMUONClusterReconstructor::ClusterizeOneDE(Int_t detElemId, + const AliMUONVDigitStore& digitStore) +{ + /// Clusterize one detection element, which digits are in digitStore + + if ( digitStore.IsEmpty() ) return; + + const AliMpVSegmentation* seg[2] = + { AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0), + AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1) + }; + + Bool_t ok = fClusterFinder->Prepare(seg,digitStore); + if ( !ok ) + { + AliWarning(Form("No hit pad for DE %d ?",detElemId)); + } + + AliMUONCluster* cluster; + + while ( ( cluster = fClusterFinder->NextCluster() ) ) + { + // Converts cluster objects into ones suitable for output + // + AliMUONRawCluster rawCluster; + + rawCluster.SetDetElemId(detElemId); + + for ( Int_t cathode = 0; cathode < 2; ++cathode ) + { + rawCluster.SetMultiplicity(cathode,cluster->Multiplicity(cathode)); + rawCluster.SetCharge(cathode,cluster->Charge()); // both cathode get the total cluster charge + Double_t xg, yg, zg; + + fTransformer->Local2Global(detElemId, + cluster->Position().X(), cluster->Position().Y(), + 0, xg, yg, zg); + + if ( cathode == 0 ) + { + AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)", + detElemId,cluster->Multiplicity(),cluster->Charge(), + cluster->Position().X(),cluster->Position().Y(),0.0, + xg,yg,zg)); + } + rawCluster.SetX(cathode,xg); + rawCluster.SetY(cathode,yg); + rawCluster.SetZ(cathode,zg); + } + fClusterStore->Add(rawCluster); + } } //____________________________________________________________________ -void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/) +void AliMUONClusterReconstructor::Digits2Clusters(const AliMUONVDigitStore& digitStore, + AliMUONVClusterStore& clusterStore) { - -// Perform cluster finding form raw data - - Fatal("Digits2Clusters","clusterization not implemented for raw data input"); + /// Clusterize the digitStore to produce a clusterStore + + fClusterStore = &clusterStore; + fClusterStore->Clear(); + + AliMpDEIterator deIt; + + deIt.First(); + + while (!deIt.IsDone()) + { + AliMUONVDigitStore* deDigits = digitStore.Create(); + + Int_t currentDE = deIt.CurrentDEId(); + AliMp::StationType stationType = AliMpDEManager::GetStationType(currentDE); + if (stationType!=AliMp::kStationTrigger) + { + TIter next(digitStore.CreateIterator(currentDE,currentDE)); + AliMUONVDigit* digit; + + while ( ( digit = static_cast(next()) ) ) + { + if ( ! digit->Charge() > 0 ) continue; // skip void digits. + + deDigits->Add(*digit,AliMUONVDigitStore::kIgnore); + } + ClusterizeOneDE(currentDE,*deDigits); + } + delete deDigits; + deIt.Next(); + } }