+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+/* $Id$ */
-#include <Riostream.h>
-#include <TDirectory.h>
-#include <TFile.h>
-#include <TObjArray.h>
-#include <TPDGCode.h>
-#include <TTree.h>
-#include <TMath.h>
+/////////////////////////////////////////////////////////////////////////////////
+//
+// AliMUONSDigitizerv1 digitizes hits from the input stream into s-digits.
+// The s-digits are written to the s-digit tree TreeS.
+// The same algorithm is implemented as for AliMUONDigitizerv1 however the
+// chamber response is not applied to the s-digits and we write to TreeS and
+// not TreeD.
+//
+/////////////////////////////////////////////////////////////////////////////////
+#include "AliMUONSDigitizerv1.h"
#include "AliMUON.h"
-#include "AliMUONChamber.h"
+#include "AliMUONLoader.h"
#include "AliMUONConstants.h"
+#include "AliMUONChamber.h"
+#include "AliMUONData.h"
#include "AliMUONDigit.h"
-#include "AliMUONSDigitizerv1.h"
#include "AliMUONHit.h"
-#include "AliMUONHitMapA1.h"
-#include "AliMUONPadHit.h"
#include "AliMUONTransientDigit.h"
-#include "AliRun.h"
-#include "AliRunLoader.h"
-#include "AliLoader.h"
+#include "AliLog.h"
ClassImp(AliMUONSDigitizerv1)
//___________________________________________
-AliMUONSDigitizerv1::AliMUONSDigitizerv1() :
- fHitMap(0),
- fTDList(0),
- fTDCounter(0),
- fDebug(0),
- fMask(0),
- fSignal(0)
+AliMUONSDigitizerv1::AliMUONSDigitizerv1()
+ : AliMUONDigitizer()
{
-// Default ctor - don't use it
- if (GetDebug()>2)
- cerr<<"AliMUONSDigitizerv1::AliMUONSDigitizerv1"
- <<"(AliRunDigitizer* manager) was processed"<<endl;
+ // Default ctor - don't use it
}
+//___________________________________________
+AliMUONSDigitizerv1::AliMUONSDigitizerv1(AliRunDigitizer* manager)
+ : AliMUONDigitizer(manager)
+{
+ // ctor which should be used
+}
-//------------------------------------------------------------------------
+//___________________________________________
AliMUONSDigitizerv1::~AliMUONSDigitizerv1()
{
-// Destructor
+ // Destructor
+}
+
+//-----------------------------------------------------------------------
+void AliMUONSDigitizerv1::GenerateTransientDigits()
+{
+// Loops over all tracks and hits in the current selected event and calls
+// MakeTransientDigitsFromHit for each hit.
+// Note: Charge correlation is applied to the tracking chambers.
+
+ TTree* treeH = fGime->TreeH();
+ AliDebug(2, Form("Generating transient digits using treeH = 0x%X"
+ , (void*)treeH));
+ //
+ // Loop over tracks
+ Int_t ntracks = (Int_t) treeH->GetEntries();
+ for (Int_t itrack = 0; itrack < ntracks; itrack++)
+ {
+ AliDebug(3, Form("Processing track %d...", itrack));
+ fMUONData->ResetHits();
+ treeH->GetEvent(itrack);
+ //
+ // Loop over hits
+ TClonesArray* hits = fMUONData->Hits();
+ for (Int_t ihit = 0; ihit < hits->GetEntriesFast(); ihit++)
+ {
+ AliMUONHit* mHit = static_cast<AliMUONHit*>( hits->At(ihit) );
+ Int_t ichamber = mHit->Chamber()-1; // chamber number
+ if (ichamber > AliMUONConstants::NCh()-1)
+ {
+ AliError(Form("Hit 0x%X has a invalid chamber number: %d", ichamber));
+ continue;
+ }
+ //
+ //Dumping Hit content:
+ AliDebug(3,Form("Hit %d: chamber = %d\tX = %f\tY = %f\tZ = %f\teloss = %f",
+ ihit, mHit->Chamber(), mHit->X(), mHit->Y(), mHit->Z(), mHit->Eloss()
+ ));
+ //
+ // Inititializing Correlation
+ AliMUONChamber& chamber = fMUON->Chamber(ichamber);
+ chamber.ChargeCorrelationInit();
+// if (ichamber < AliMUONConstants::NTrackingCh())
+// {
+// // Tracking Chamber
+// // Initialize hit position (cursor) in the segmentation model
+
+// chamber.SigGenInit(mHit);
+
+// } // else do nothing for Trigger Chambers
+
+ MakeTransientDigitsFromHit(itrack, ihit, mHit);
+ } // hit loop
+ } // track loop
+}
+
+//--------------------------------------------------------------------------
+void AliMUONSDigitizerv1::MakeTransientDigitsFromHit(Int_t track, Int_t iHit, AliMUONHit * mHit)
+{
+// This method is called for every hit in an event to generate AliMUONTransientDigits
+// from the hit and add these to fTDList.
+// The AliMUONChamber::DisIntegration method us used to figure out which pads are
+// fired for a given hit. We then loop over the fired pads and add an AliMUONTransientDigit
+// for each pad.
+
+ AliDebug(4,Form("Making transient digit for hit number %d.", iHit));
+
+ //
+ // Calls the charge disintegration method of the current chamber
+ AliDebug(5,"Calling AliMUONChamber::DisIngtegration...");
+
+ Float_t newdigit[6][500]; // Pad information
+ Int_t nnew=0; // Number of touched Pads per hit
+ Int_t ichamber = mHit->Chamber()-1;
+ AliMUONChamber& chamber = fMUON->Chamber(ichamber);
+
+ chamber.DisIntegration(mHit, nnew, newdigit);
+
+ // Creating new TransientDigits from hit
+ for(Int_t iTD = 0; iTD < nnew; iTD++)
+ {
+ Int_t charge;
+ Int_t digits[7];
+
+ digits[0] = Int_t(newdigit[1][iTD]); // Padx of the Digit
+ digits[1] = Int_t(newdigit[2][iTD]); // Pady of the Digit
+ digits[2] = Int_t(newdigit[5][iTD]); // Cathode plane
+ digits[3] = Int_t(newdigit[3][iTD]); // Induced charge in the Pad
+ if (fSignal)
+ {
+ charge = digits[3];
+ digits[4] = Int_t(newdigit[3][iTD]); // Signal due to physics
+ }
+ else
+ {
+ charge = digits[3] + fMask;
+ digits[4] = 0; // No signal due to physics since this is now background.
+ }
+ digits[5] = iHit+fMask; // Hit number in the list
+ digits[6] = mHit->DetElemId();
+
+ AliDebug(5,Form("MakeTransientDigitsFromHit",
+ "DisIntegration result %d: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d\tidDE %d",
+ iTD, digits[0], digits[1], digits[2], digits[3], digits[5], digits[6]));
+
+ AliMUONTransientDigit* mTD = new AliMUONTransientDigit(ichamber, digits);
+ mTD->AddToTrackList(track + fMask, charge);
+
+ OnCreateTransientDigit(mTD, mHit);
+ AddOrUpdateTransientDigit(mTD);
+ }
}
//------------------------------------------------------------------------
-void AliMUONSDigitizerv1::AddTransientDigit(AliMUONTransientDigit * mTD)
+void AliMUONSDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7])
{
- // Choosing the maping of the cathode plane of the chamber:
- Int_t iNchCpl= mTD->Chamber() + (mTD->Cathode()-1) * AliMUONConstants::NCh();
- fTDList->AddAtAndExpand(mTD, fTDCounter);
- fHitMap[iNchCpl]->SetHit( mTD->PadX(), mTD->PadY(), fTDCounter);
- fTDCounter++;
+// Derived to write to the s-digit tree TreeS.
+
+ fMUONData->AddSDigit(chamber, tracks, charges, digits);
}
//------------------------------------------------------------------------
-Bool_t AliMUONSDigitizerv1::ExistTransientDigit(AliMUONTransientDigit * mTD)
+Int_t AliMUONSDigitizerv1::GetSignalFrom(AliMUONTransientDigit* td)
{
- // Choosing the maping of the cathode plane of the chamber:
- Int_t iNchCpl= mTD->Chamber() + (mTD->Cathode()-1) * AliMUONConstants::NCh();
- return( fHitMap[iNchCpl]->TestHit(mTD->PadX(), mTD->PadY()) );
+// Returns the transient digit signal as is without applying the chamber response.
+ AliDebug(4,"Returning TransientDigit signal.");
+ return td->Signal();
}
//------------------------------------------------------------------------
-Bool_t AliMUONSDigitizerv1::Init()
+Bool_t AliMUONSDigitizerv1::InitOutputData(AliMUONLoader* muonloader)
{
+// Overridden to initialise the output tree to be TreeS rather than TreeD.
+ AliDebug(3,"Creating s-digits branch and setting the tree address.");
+
+ fMUONData->SetLoader(muonloader);
-// Initialization
- if (GetDebug()>2) Info("Init","AliMUONSDigitizerv1::Init() starts");
-
- //Loaders (We assume input0 to be the output too)
- AliRunLoader * runloader; // Input loader
- AliLoader * gime;
-
- // Getting runloader
- runloader = AliRunLoader::GetRunLoader();
- if (runloader == 0x0) {
- Error("Init","RunLoader is not in input file 0");
- return kFALSE; // RunDigitizer is not working.
- }
- // Getting MUONloader
- gime = runloader->GetLoader("MUONLoader");
- gime->LoadHits("READ");
- gime->LoadSDigits("RECREATE");
-
- return kTRUE;
+ // New branch per chamber for MUON digit in the tree of digits
+ if (muonloader->TreeS() == NULL)
+ {
+ muonloader->MakeSDigitsContainer();
+ if (muonloader->TreeS() == NULL)
+ {
+ AliError("Could not create TreeS.");
+ return kFALSE;
+ }
+ }
+
+ fMUONData->MakeBranch("S");
+ fMUONData->SetTreeAddress("S");
+
+ return kTRUE;
}
//------------------------------------------------------------------------
-void AliMUONSDigitizerv1::UpdateTransientDigit(Int_t track, AliMUONTransientDigit * mTD)
+void AliMUONSDigitizerv1::FillOutputData()
{
- // Choosing the maping of the cathode plane of the chamber:
- Int_t iNchCpl= mTD->Chamber() + (mTD->Cathode()-1) * AliMUONConstants::NCh();
- AliMUONTransientDigit *pdigit =
- static_cast<AliMUONTransientDigit*>(fHitMap[iNchCpl]->GetHit(mTD->PadX(),mTD->PadY()));
- // update charge
- //
- Int_t iqpad = mTD->Signal(); // charge per pad
- pdigit->AddSignal(iqpad);
- pdigit->AddPhysicsSignal(iqpad);
- // update list of tracks
- //
- Int_t charge;
- track=+ fMask;
- if (fSignal) charge = iqpad;
- //else charge = kBgTag;
- else charge = iqpad + fMask;
-
- pdigit->UpdateTrackList(track,charge);
-}
+// Overridden to fill TreeS rather than TreeD.
+ AliDebug(3,"Filling trees with s-digits.");
+ fMUONData->Fill("S");
+ fMUONData->ResetSDigits();
+}
-//--------------------------------------------------------------------------
-void AliMUONSDigitizerv1::MakeTransientDigit(Int_t track, Int_t iHit, AliMUONHit * mHit)
+//------------------------------------------------------------------------
+void AliMUONSDigitizerv1::CleanupOutputData(AliMUONLoader* muonloader)
{
- AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
- if (!pMUON) {
- cerr<<"AliMUONSDigitizerv1::MakeTransientDigit Error:"
- <<" module MUON not found in the input file"<<endl;
- }
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit starts"<<endl;
- Int_t ichamber = mHit->Chamber()-1;
- AliMUONChamber & chamber = pMUON->Chamber(ichamber);
- Float_t xhit = mHit->X();
- Float_t yhit = mHit->Y();
- Float_t zhit = mHit->Z();
- Float_t eloss= mHit->Eloss();
- Float_t tof = mHit->Age();
- // Variables for chamber response from AliMUONChamber::DisIntegration
- Float_t newdigit[6][500]; // Pad information
- Int_t nnew=0; // Number of touched Pads per hit
- Int_t digits[6];
-
- //
- // Calls the charge disintegration method of the current chamber
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit calling AliMUONChamber::DisIngtegration starts"<<endl;
- chamber.DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newdigit);
- // Creating a new TransientDigits from hit
- for(Int_t iTD=0; iTD<nnew; iTD++) {
- digits[0] = Int_t(newdigit[1][iTD]); // Padx of the Digit
- digits[1] = Int_t(newdigit[2][iTD]); // Pady of the Digit
- digits[2] = Int_t(newdigit[5][iTD]); // Cathode plane
- digits[3] = Int_t(newdigit[3][iTD]); // Induced charge in the Pad !!!! Int_t not correct
- if (fSignal) digits[4] = Int_t(newdigit[3][iTD]);
- else digits[4] = 0;
- digits[5] = iHit+fMask; // Hit number in the list
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit " <<
- cerr<<"AliMUONSDigitizerv1::MakeTransientDigit " <<
- "PadX "<< digits[0] << " " <<
- "PadY "<< digits[1] << " " <<
- "Plane " << digits[2] << " " <<
- "Charge " << digits[3] <<" " <<
- "newdigit " << newdigit[3][iTD] <<" " <<
- "Hit " << digits[5] << endl;
- // list of tracks
- Int_t charge;
- track += fMask;
- if (fSignal) charge = digits[3];
- //else charge = kBgTag;
- else charge = digits[3] + fMask;
-
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit Creating AliMUONTransientDigit"<<endl;
- AliMUONTransientDigit * mTD = new AliMUONTransientDigit(ichamber, digits);
- mTD->AddToTrackList(track,charge);
- if (!ExistTransientDigit(mTD)) {
- AddTransientDigit(mTD);
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit Adding TransientDigit"<<endl;
- }
- else {
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::MakeTransientDigit updating TransientDigit"<<endl;
- UpdateTransientDigit(track, mTD);
- delete mTD;
- }
- }
+// Overridden to write and then cleanup TreeS that was initialised in InitOutputData.
+ AliDebug(3,"Writing s-digits and releasing pointers.");
+ muonloader->WriteSDigits("OVERWRITE");
+ fMUONData->ResetSDigits();
+ muonloader->UnloadSDigits();
}
-//-----------------------------------------------------------------------
-void AliMUONSDigitizerv1::Exec(Option_t* option)
+
+//------------------------------------------------------------------------
+Bool_t AliMUONSDigitizerv1::InitInputData(AliMUONLoader* muonloader)
{
- TString optionString = option;
- if (optionString.Data() == "deb") {
- Info("SDigitize","Called with option deb ");
- fDebug = 3;
- }
-
- AliMUONChamber* chamber;
- AliSegmentation* c1Segmentation; //Cathode plane c1 of the chamber
- AliSegmentation* c2Segmentation; //Cathode place c2 of the chamber
-
- if (GetDebug()>2) Info("SDigitize","AliMUONSDigitizerv1::Exec starts");
- fTDList = new TObjArray;
-
- //Loaders (We assume input0 to be the output too)
- AliRunLoader * runloader; // Input loader
- AliLoader * gime;
-
- // Getting runloader
- runloader = AliRunLoader::GetRunLoader();
- if (runloader == 0x0) {
- Error("SDigitize","RunLoader is not in input file 0");
- return; // RunDigitizer is not working.
- }
- // Getting MUONloader
- gime = runloader->GetLoader("MUONLoader");
- if (gime->TreeH()==0x0) {
- if (GetDebug()>2) Info("SDigitize","TreeH is not loaded yet. Loading...");
- gime->LoadHits("READ");
- if (GetDebug()>2) Info("SDigitize","Now treeH is %#x. MUONLoader is %#x",gime->TreeH(),gime);
- }
-
- if (GetDebug()>2) Info("SDigitize","Loaders ready");
-
- if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice();
- gAlice = runloader->GetAliRun();
-
- // Getting Module MUON
- AliMUON *pMUON = (AliMUON *) gAlice->GetDetector("MUON");
- if (!pMUON) {
- Error("SDigitize","Module MUON not found in the input file");
- return;
- }
- // Getting Muon data
- AliMUONData * muondata = pMUON->GetMUONData();
- muondata->SetLoader(gime);
- muondata->SetTreeAddress("H");
-
- Int_t currentevent = runloader->GetEventNumber();
-
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::Exec Event Number is "<<currentevent <<endl;
- if ( (currentevent<10) ||
- (Int_t(TMath::Log10(currentevent)) == TMath::Log10(currentevent) ) )
- cout <<"AliMUONSDigitizerv1::Exec Event Number is "<< currentevent <<endl;
-
- // New branch per chamber for MUON digit in the tree of digits
- if (gime->TreeS() == 0x0) {
- gime->MakeSDigitsContainer();
- }
- TTree* treeS = gime->TreeS();
- muondata->MakeBranch("S");
- muondata->SetTreeAddress("S");
-
- // Array of pointer of the AliMUONHitMapA1:
- // two HitMaps per chamber, or one HitMap per cahtode plane
- fHitMap= new AliMUONHitMapA1* [2*AliMUONConstants::NCh()];
-
- //Loop over chambers for the definition AliMUONHitMap
- for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
- chamber = &(pMUON->Chamber(i));
- c1Segmentation = chamber->SegmentationModel(1); // Cathode plane 1
- fHitMap[i] = new AliMUONHitMapA1(c1Segmentation, fTDList);
- c2Segmentation = chamber->SegmentationModel(2); // Cathode plane 2
- fHitMap[i+AliMUONConstants::NCh()] = new AliMUONHitMapA1(c2Segmentation, fTDList);
- }
-
-// Loop to Sdigitize
- fSignal = kTRUE;
-
- // Setting the address
- TTree *treeH = gime->TreeH();
- if (treeH == 0x0) {
- Error("SDigitize","Can not get TreeH from input ");
- Info("SDigitize","Now treeH is %#x. MUONLoader is %#x",gime->TreeH(),gime);
- return;
- }
- if (GetDebug()>2) {
- cerr<<"AliMUONSDigitizerv1::Exec treeH" << treeH <<endl;
- }
-
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::Exec Setting tree addresses"<<endl;
-
- //
- // Loop over tracks
- Int_t itrack;
- Int_t ntracks = (Int_t) treeH->GetEntries();
- for (itrack = 0; itrack < ntracks; itrack++) {
- if (GetDebug()>2) cerr<<"AliMUONSDigitizerv1::Exec itrack = "<<itrack<<endl;
- muondata->ResetHits();
- treeH->GetEvent(itrack);
- //
- // Loop over hits
- Int_t ihit, ichamber;
- AliMUONHit* mHit;
- TClonesArray* hits = muondata->Hits();
- for(ihit = 0; ihit < hits->GetEntriesFast(); ihit++) {
- mHit = static_cast<AliMUONHit*>(hits->At(ihit));
- ichamber = mHit->Chamber()-1; // chamber number
- if (ichamber > AliMUONConstants::NCh()-1) {
- cerr<<"AliMUONSDigitizer: ERROR: "
- <<"fNch > AliMUONConstants::NCh()-1, fNch, NCh(): "
- <<ichamber<<", "<< AliMUONConstants::NCh()<<endl;
- return;
- }
- chamber = &(pMUON->Chamber(ichamber));
- //
- //Dumping Hit content:
- if (GetDebug()>2) {
- cerr<<"AliMuonDigitizerv1::Exec ihit, ichamber, x, y, z, eloss " <<
- ihit << " " <<
- mHit->Chamber() << " " <<
- mHit->X() << " " <<
- mHit->Y() << " " <<
- mHit->Z() << " " <<
- mHit->Eloss() << " " << endl;
- }
- //
- // Inititializing Correlation
- chamber->ChargeCorrelationInit();
- if (ichamber < AliMUONConstants::NTrackingCh()) {
- // Tracking Chamber
- // Initialize hit position (cursor) in the segmentation model
- chamber->SigGenInit(mHit->X(), mHit->Y(), mHit->Z());
- } else {
- // Trigger Chamber
- }
- MakeTransientDigit(itrack, ihit, mHit);
- } // hit loop
- } // track loop
- if (GetDebug()>2) cerr<<"AliMUONSDigitizer::Exec End of hits, track and file loops"<<endl;
-
- // Loop on cathodes
- Int_t icat;
- for(icat=0; icat<2; icat++) {
- //
- // Filling SDigit List
- Int_t tracks[kMAXTRACKS];
- Int_t charges[kMAXTRACKS];
- Int_t nentries = fTDList->GetEntriesFast();
- Int_t digits[6];
- for (Int_t nent = 0; nent < nentries; nent++) {
- AliMUONTransientDigit *address = (AliMUONTransientDigit*)fTDList->At(nent);
- if (address == 0) continue;
- Int_t ich = address->Chamber();
- Int_t q = address->Signal();
-
- if (!q) continue; // not mandatory ?
-
- digits[0] = address->PadX();
- digits[1] = address->PadY();
- digits[2] = address->Cathode()-1;
- digits[3] = q;
- digits[4] = address->Physics();
- digits[5] = address->Hit();
-
- Int_t nptracks = address->GetNTracks();
-
- if (nptracks > kMAXTRACKS) {
- if (GetDebug() >0) {
- cerr<<"AliMUONSDigitizer:Exec nptracks > 10 "<<nptracks;
- cerr<<"reset to max value "<<kMAXTRACKS<<endl;
- }
- nptracks = kMAXTRACKS;
- }
- if (nptracks > 2 && GetDebug() >2) {
- cerr<<"AliMUONSDigitizer::Exec nptracks > 2 "<<nptracks<<endl;
- // printf("cat,ich,ix,iy,q %d %d %d %d %d \n",icat,ich,digits[0],digits[1],q);
- }
- for (Int_t tr = 0; tr < nptracks; tr++) {
- tracks[tr] = address->GetTrack(tr);
- charges[tr] = address->GetCharge(tr);
- } //end loop over list of tracks for one pad
- // Sort list of tracks according to charge
- if (nptracks > 1) {
- SortTracks(tracks,charges,nptracks);
- }
- if (nptracks < kMAXTRACKS ) {
- for (Int_t i = nptracks; i < kMAXTRACKS; i++) {
- tracks[i] = -1;
- charges[i] = 0;
- }
+// Derived to initialise the input to read from TreeH the hits tree.
+// If the hits are not loaded then we load the hits using the muon loader.
+
+ AliDebug(3, "Loading hits in READ mode and setting the tree address.");
+
+ fMUONData->SetLoader(muonloader);
+
+ if (muonloader->TreeH() == NULL)
+ {
+ muonloader->LoadHits("READ");
+ if (muonloader->TreeH() == NULL)
+ {
+ AliError("Can not load the hits tree.");
+ return kFALSE;
+ }
}
-
- // Add Sdigits
- if (GetDebug()>3) cerr<<"AliMUONSDigitzerv1::Exec TransientDigit to SDigit"<<endl;
- if ( digits[2] == icat ) muondata->AddSDigit(ich,tracks,charges,digits);
-// printf("test rm ich %d padX %d padY %d \n",ich, digits[0], digits[1]);
- }
- // Filling list of Sdigits per chamber for a given cathode.
- muondata->Fill("S");
- muondata->ResetSDigits();
- } // end loop cathode
- fTDList->Delete();
-
- for(Int_t ii = 0; ii < 2*AliMUONConstants::NCh(); ++ii) {
- if (fHitMap[ii]) {
- delete fHitMap[ii];
- fHitMap[ii] = 0;
- }
- }
-
- if (GetDebug()>2)
- cerr<<"AliMUONSDigitizer::Exec: writing the TreeS: "
- <<treeS->GetName()<<endl;
-
- runloader = AliRunLoader::GetRunLoader();
- gime = runloader->GetLoader("MUONLoader");
- gime->WriteSDigits("OVERWRITE");
- delete [] fHitMap;
- delete fTDList;
- muondata->ResetHits();
- gime->UnloadHits();
- gime->UnloadSDigits();
+
+ fMUONData->SetTreeAddress("H");
+ return kTRUE;
}
+
//------------------------------------------------------------------------
-void AliMUONSDigitizerv1::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr)
+void AliMUONSDigitizerv1::CleanupInputData(AliMUONLoader* muonloader)
{
- //
- // Sort the list of tracks contributing to a given Sdigit
- // Only the 3 most significant tracks are acctually sorted
- //
-
- //
- // Loop over signals, only 3 times
- //
-
- Int_t qmax;
- Int_t jmax;
- Int_t idx[3] = {-2,-2,-2};
- Int_t jch[3] = {-2,-2,-2};
- Int_t jtr[3] = {-2,-2,-2};
- Int_t i,j,imax;
-
- if (ntr<3) imax=ntr;
- else imax=3;
- for(i=0;i<imax;i++){
- qmax=0;
- jmax=0;
-
- for(j=0;j<ntr;j++){
-
- if((i == 1 && j == idx[i-1])
- ||(i == 2 && (j == idx[i-1] || j == idx[i-2]))) continue;
-
- if(charges[j] > qmax) {
- qmax = charges[j];
- jmax=j;
- }
- }
-
- if(qmax > 0) {
- idx[i]=jmax;
- jch[i]=charges[jmax];
- jtr[i]=tracks[jmax];
- }
-
- }
-
- for(i=0;i<3;i++){
- if (jtr[i] == -2) {
- charges[i]=0;
- tracks[i]=0;
- } else {
- charges[i]=jch[i];
- tracks[i]=jtr[i];
- }
- }
+// Derived to release the loaded hits and unload them.
+
+ AliDebug(3, "Releasing loaded hits.");
+ fMUONData->ResetHits();
+ muonloader->UnloadHits();
}
+