**************************************************************************/
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////////
-// //
-// class for MUON reconstruction //
-// //
-///////////////////////////////////////////////////////////////////////////////
+//-----------------------------
+// Class AliMUONReconstructor
+//-----------------------------
+// Class for the
+// MUON track reconstruction
#include "AliMUONReconstructor.h"
#include "AliESD.h"
#include "AliESDMuonTrack.h"
-#include "AliGenEventHeader.h"
-#include "AliHeader.h"
#include "AliLog.h"
-#include "AliMUON.h"
+#include "AliMUONConstants.h"
#include "AliMUONCalibrationData.h"
#include "AliMUONClusterFinderAZ.h"
-#include "AliMUONClusterFinderVS.h"
#include "AliMUONClusterReconstructor.h"
#include "AliMUONData.h"
#include "AliMUONDigitCalibrator.h"
#include "AliMUONEventRecoCombi.h"
-#include "AliMUONRawReader.h"
+#include "AliMUONDigitMaker.h"
#include "AliMUONTrack.h"
#include "AliMUONTrackParam.h"
+#include "AliMUONTrackExtrap.h"
+#include "AliMUONVTrackReconstructor.h"
#include "AliMUONTrackReconstructor.h"
+#include "AliMUONTrackReconstructorK.h"
#include "AliMUONTriggerTrack.h"
+#include "AliMUONTriggerCircuit.h"
+#include "AliMUONTriggerCrateStore.h"
+
+#include "AliMpSegmentation.h"
+
+#include "AliMUONPreClusterFinder.h"
+#include "AliMUONClusterFinderCOG.h"
+#include "AliMUONClusterFinderSimpleFit.h"
+#include "AliMUONClusterFinderMLEM.h"
+
#include "AliRawReader.h"
#include "AliRun.h"
#include "AliRunLoader.h"
#include "TTask.h"
-#include <TArrayF.h>
-#include <TParticle.h>
#include "TStopwatch.h"
+/// \cond CLASSIMP
ClassImp(AliMUONReconstructor)
+/// \endcond
//_____________________________________________________________________________
AliMUONReconstructor::AliMUONReconstructor()
- : AliReconstructor(), fCalibrationData(0x0)
+ : AliReconstructor(),
+ fRunLoader(0x0),
+ fDigitMaker(new AliMUONDigitMaker()),
+ fCalibrationData(0x0),
+ fCrateManager(new AliMUONTriggerCrateStore()),
+ fTriggerCircuit(new TClonesArray("AliMUONTriggerCircuit", 234)),
+ fTransformer(new AliMUONGeometryTransformer(kTRUE))
+
{
- AliDebug(1,"");
-}
+/// Default constructor
-//______________________________________________________________________________
-AliMUONReconstructor::AliMUONReconstructor(const AliMUONReconstructor& right)
- : AliReconstructor(right)
-{
-/// Protected copy constructor (not implemented)
+ AliDebug(1,"");
+ // Crate manager
+ fCrateManager->ReadFromFile();
+
+ // set to digit maker
+ fDigitMaker->SetCrateManager(fCrateManager);
+
+ // transformater
+ fTransformer->ReadGeometryData("volpath.dat", "geometry.root");
+
+ // trigger circuit
+ for (Int_t i = 0; i < AliMUONConstants::NTriggerCircuit(); i++) {
+ AliMUONTriggerCircuit* c = new AliMUONTriggerCircuit();
+ c->SetTransformer(fTransformer);
+ c->Init(i,*fCrateManager);
+ TClonesArray& circuit = *fTriggerCircuit;
+ new(circuit[circuit.GetEntriesFast()])AliMUONTriggerCircuit(*c);
+ delete c;
+ }
- AliFatal("Copy constructor not provided.");
+
}
//_____________________________________________________________________________
AliMUONReconstructor::~AliMUONReconstructor()
{
+/// Destructor
+
AliDebug(1,"");
delete fCalibrationData;
+ delete fDigitMaker;
+ delete fCrateManager;
+ delete fTriggerCircuit;
+ delete fTransformer;
}
-//______________________________________________________________________________
-AliMUONReconstructor&
-AliMUONReconstructor::operator=(const AliMUONReconstructor& right)
-{
-/// Protected assignement operator (not implemented)
-
- // check assignement to self
- if (this == &right) return *this;
-
- AliFatal("Assignement operator not provided.");
-
- return *this;
-}
-
//_____________________________________________________________________________
TTask*
AliMUONReconstructor::GetCalibrationTask(AliMUONData* data) const
{
- //
- // Create the calibration task(s).
- //
+/// Create the calibration task(s).
const AliRun* run = fRunLoader->GetAliRun();
-
- // Not really clean, but for the moment we must check whether the
- // simulation has decalibrated the data or not...
- const AliMUON* muon = static_cast<AliMUON*>(run->GetModule("MUON"));
- if ( muon->DigitizerType().Contains("NewDigitizer") )
- {
- AliInfo("Calibration will occur.");
- Int_t runNumber = run->GetRunNumber();
- fCalibrationData = new AliMUONCalibrationData(runNumber);
- if ( !fCalibrationData->IsValid() )
+
+ AliInfo("Calibration will occur.");
+ Int_t runNumber = run->GetRunNumber();
+ fCalibrationData = new AliMUONCalibrationData(runNumber);
+ if ( !fCalibrationData->IsValid() )
{
AliError("Could not retrieve calibrations !");
delete fCalibrationData;
fCalibrationData = 0x0;
return 0x0;
}
- TTask* calibration = new TTask("MUONCalibrator","MUON Digit calibrator");
- calibration->Add(new AliMUONDigitCalibrator(data,fCalibrationData));
- //FIXME: calibration->Add(something about dead channels should go here).
- return calibration;
- }
- else
- {
- AliInfo("Detected the usage of old digitizer (w/o decalibration). "
- "Will not calibrate then.");
- return 0x0;
- }
+ TTask* calibration = new TTask("MUONCalibrator","MUON Digit calibrator");
+ calibration->Add(new AliMUONDigitCalibrator(data,fCalibrationData));
+ //FIXME: calibration->Add(something about dead channels should go here).
+ return calibration;
+
}
//_____________________________________________________________________________
void
AliMUONReconstructor::Init(AliRunLoader* runLoader)
{
+/// Initialize
+
fRunLoader = runLoader;
}
+//_____________________________________________________________________________
+AliMUONClusterReconstructor*
+AliMUONReconstructor::CreateClusterReconstructor(AliMUONData* data) const
+{
+/// Create cluster reconstructor
+
+ AliMUONVClusterFinder* clusterFinder(0x0);
+
+ TString opt(GetOption());
+ opt.ToUpper();
+
+ if ( strstr(opt,"PRECLUSTER") )
+ {
+ clusterFinder = new AliMUONPreClusterFinder;
+ }
+ else if ( strstr(opt,"COG") )
+ {
+ clusterFinder = new AliMUONClusterFinderCOG;
+ }
+ else if ( strstr(opt,"SIMPLEFIT") )
+ {
+ clusterFinder = new AliMUONClusterFinderSimpleFit;
+ }
+ else if ( strstr(opt,"MLEM:DRAW") )
+ {
+ clusterFinder = new AliMUONClusterFinderMLEM(kTRUE);
+ }
+ else if ( strstr(opt,"MLEM") )
+ {
+ clusterFinder = new AliMUONClusterFinderMLEM(kFALSE);
+ }
+
+ if ( clusterFinder)
+ {
+ AliInfo(Form("Will use %s for clusterizing",clusterFinder->ClassName()));
+ }
+
+ AliMUONClusterReconstructor* clusterReco =
+ new AliMUONClusterReconstructor(data,clusterFinder,fTransformer);
+ return clusterReco;
+}
+
//_____________________________________________________________________________
void AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader) const
{
-// AliLoader
+/// Reconstruct
+/// \todo add more
+
AliLoader* loader = runLoader->GetLoader("MUONLoader");
- Int_t nEvents = runLoader->GetNumberOfEvents();
+ Int_t nEvents = runLoader->GetNumberOfEvents();
+ Int_t evtNumber = runLoader->GetEventNumber();
AliMUONData* data = new AliMUONData(loader,"MUON","MUON");
// passing loader as argument.
- AliMUONTrackReconstructor* recoEvent = new AliMUONTrackReconstructor(loader, data);
-
- if (strstr(GetOption(),"Original"))
- recoEvent->SetTrackMethod(1); // Original tracking
- else if (strstr(GetOption(),"Combi"))
- recoEvent->SetTrackMethod(3); // Combined cluster / track
- else
- recoEvent->SetTrackMethod(2); // Kalman
+ AliMUONVTrackReconstructor* recoEvent;
+ if (strstr(GetOption(),"Original")) recoEvent = new AliMUONTrackReconstructor(data);
+ else if (strstr(GetOption(),"Combi")) recoEvent = new AliMUONTrackReconstructorK(data,"Combi");
+ else recoEvent = new AliMUONTrackReconstructorK(data,"Kalman");
+
+ recoEvent->SetTriggerCircuit(fTriggerCircuit);
- AliMUONClusterReconstructor* recoCluster = new AliMUONClusterReconstructor(data);
+ AliMUONClusterReconstructor* recoCluster = CreateClusterReconstructor(data);
AliMUONClusterFinderVS *recModel = recoCluster->GetRecoModel();
recoCluster->SetRecoModel(recModel);
}
recModel->SetGhostChi2Cut(10);
+ recModel->SetEventNumber(evtNumber);
loader->LoadDigits("READ");
loader->LoadRecPoints("RECREATE");
TTask* calibration = GetCalibrationTask(data);
- Int_t chBeg = recoEvent->GetTrackMethod() == 3 ? 6 : 0;
+ Int_t chBeg = (strstr(GetOption(),"Combi") ? 6 : 0);
+
// Loop over events
for(Int_t ievent = 0; ievent < nEvents; ievent++) {
if (!loader->TreeR()) loader->MakeRecPointsContainer();
// tracking branch
- if (recoEvent->GetTrackMethod() != 3) {
+ if (!strstr(GetOption(),"Combi")) {
data->MakeBranch("RC");
data->SetTreeAddress("D,RC");
} else {
recoCluster->Digits2Clusters(chBeg);
- if (recoEvent->GetTrackMethod() == 3) {
+ if (strstr(GetOption(),"Combi")) {
// Combined cluster / track finder
AliMUONEventRecoCombi::Instance()->FillEvent(data, (AliMUONClusterFinderAZ*)recModel);
((AliMUONClusterFinderAZ*) recModel)->SetReco(2);
loader->WriteTracks("OVERWRITE");
- if (recoEvent->GetTrackMethod() == 3) {
+ if (strstr(GetOption(),"Combi")) {
// Combined cluster / track
((AliMUONClusterFinderAZ*) recModel)->SetReco(1);
data->MakeBranch("RC");
data->SetTreeAddress("RC");
- AliMUONEventRecoCombi::Instance()->FillRecP(data, recoEvent);
+ AliMUONEventRecoCombi::Instance()->FillRecP(data, (AliMUONTrackReconstructorK*)recoEvent);
data->Fill("RC");
}
loader->WriteRecPoints("OVERWRITE");
//--------------------------- Resetting branches -----------------------
data->ResetDigits();
- data->ResetRawClusters();
- data->ResetTrigger();
-
data->ResetRawClusters();
data->ResetTrigger();
data->ResetRecTracks();
}
//_____________________________________________________________________________
-void AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const
+void AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader,
+ AliRawReader* rawReader) const
{
+/// Recontruct
+/// \todo add more
+
// AliLoader
AliLoader* loader = runLoader->GetLoader("MUONLoader");
+ Int_t evtNumber = runLoader->GetEventNumber();
+
AliMUONData data(loader,"MUON","MUON");
// passing loader as argument.
- AliMUONTrackReconstructor recoEvent(loader, &data);
+ fDigitMaker->SetMUONData(&data);
- AliMUONRawReader rawData(&data);
+ AliMUONClusterReconstructor* recoCluster = CreateClusterReconstructor(&data);
- AliMUONClusterReconstructor recoCluster(&data);
+ AliMUONVTrackReconstructor *recoEvent;
+ if (strstr(GetOption(),"Original")) recoEvent = new AliMUONTrackReconstructor(&data);
+ else if (strstr(GetOption(),"Combi")) recoEvent = new AliMUONTrackReconstructorK(&data,"Combi");
+ else recoEvent = new AliMUONTrackReconstructorK(&data,"Kalman");
+
+ recoEvent->SetTriggerCircuit(fTriggerCircuit);
+
+ AliMUONClusterFinderVS *recModel = recoCluster->GetRecoModel();
- if (strstr(GetOption(),"Original"))
- {
- recoEvent.SetTrackMethod(1); // Original tracking
- }
- else
- {
- recoEvent.SetTrackMethod(2); // Kalman
- }
-
- AliMUONClusterFinderVS *recModel = recoCluster.GetRecoModel();
if (!strstr(GetOption(),"VS"))
{
recModel = (AliMUONClusterFinderVS*) new AliMUONClusterFinderAZ();
- recoCluster.SetRecoModel(recModel);
+ recoCluster->SetRecoModel(recModel);
}
recModel->SetGhostChi2Cut(10);
+ recModel->SetEventNumber(evtNumber);
TTask* calibration = GetCalibrationTask(&data);
loader->LoadRecPoints("RECREATE");
loader->LoadTracks("RECREATE");
- loader->LoadDigits("READ");
-
+
+ // Digits are not stored on disk and created on flight from rawdata.
+ // In order to write digits on disk the following line should be uncommented
+ // loader->LoadDigits("RECREATE");
+
// Loop over events
Int_t iEvent = 0;
runLoader->GetEvent(iEvent++);
//----------------------- raw2digits & raw2trigger-------------------
- if (!loader->TreeD())
- {
- AliDebug(1,Form("Making Digit Container for event %d",iEvent));
- loader->MakeDigitsContainer();
- }
-
- data.SetTreeAddress("D,GLT");
+// if (!loader->TreeD())
+// {
+// AliDebug(1,Form("Making Digit Container for event %d",iEvent));
+// loader->MakeDigitsContainer();
+// }
+ // Digits are not stored on disk and created on flight from rawdata.
+ // In order to write digits on disk the following lines should be uncommented
+ // data.MakeBranch("D,GLT");
+ // data.SetTreeAddress("D,GLT");
+ data.SetDataContainer("D, GLT");
rawTimer.Start(kFALSE);
- rawData.Raw2Digits(rawReader);
+ fDigitMaker->Raw2Digits(rawReader);
rawTimer.Stop();
if ( calibration )
calibration->ExecuteTask();
calibTimer.Stop();
}
-
+ // Digits are not stored on disk and created on flight from rawdata.
+ // In order to write digits on disk the following lines should be uncommented
+ // data.Fill("D,GLT");
+ // loader->WriteDigits("OVERWRITE");
//----------------------- digit2cluster & Trigger2Trigger -------------------
clusterTimer.Start(kFALSE);
// tracking branch
data.MakeBranch("RC");
data.SetTreeAddress("RC");
- recoCluster.Digits2Clusters();
+ recoCluster->Digits2Clusters();
data.Fill("RC");
// trigger branch
data.MakeBranch("TC");
data.SetTreeAddress("TC");
-// recoCluster.Trigger2Trigger();
data.Fill("TC");
loader->WriteRecPoints("OVERWRITE");
// trigger branch
data.MakeBranch("RL"); //trigger track
data.SetTreeAddress("RL");
- recoEvent.EventReconstructTrigger();
+ recoEvent->EventReconstructTrigger();
data.Fill("RL");
// tracking branch
data.MakeBranch("RT"); //track
data.SetTreeAddress("RT");
- recoEvent.EventReconstruct();
+ recoEvent->EventReconstruct();
data.Fill("RT");
loader->WriteTracks("OVERWRITE");
//--------------------------- Resetting branches -----------------------
data.ResetDigits();
- data.ResetRawClusters();
- data.ResetTrigger();
-
data.ResetRawClusters();
data.ResetTrigger();
data.ResetRecTracks();
loader->UnloadRecPoints();
loader->UnloadTracks();
loader->UnloadDigits();
+
+ delete recoEvent;
+ delete recoCluster;
+
AliInfo(Form("Execution time for converting RAW data to digits in MUON : R:%.2fs C:%.2fs",
rawTimer.RealTime(),rawTimer.CpuTime()));
AliInfo(Form("Execution time for calibrating MUON : R:%.2fs C:%.2fs",
//_____________________________________________________________________________
void AliMUONReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
{
+/// Fill ESD
+/// \todo add more
+
TClonesArray* recTracksArray = 0;
TClonesArray* recTrigTracksArray = 0;
AliMUONTrack* recTrack = 0;
AliMUONTrackParam* trackParam = 0;
AliMUONTriggerTrack* recTriggerTrack = 0;
-// TParticle* particle = new TParticle();
-// AliGenEventHeader* header = 0;
+
iEvent = runLoader->GetEventNumber();
runLoader->GetEvent(iEvent);
// Get vertex
Double_t vertex[3] = {0};
const AliESDVertex *esdVert = esd->GetVertex();
- if (esdVert) esdVert->GetXYZ(vertex);
-
- // nPrimary = 0;
-// if ( (header = runLoader->GetHeader()->GenEventHeader()) ) {
-// header->PrimaryVertex(vertex);
-// } else {
-// runLoader->LoadKinematics("READ");
-// runLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle);
-// nPart = (Int_t)runLoader->TreeK()->GetEntries();
-// for(Int_t iPart = 0; iPart < nPart; iPart++) {
-// runLoader->TreeK()->GetEvent(iPart);
-// if (particle->GetFirstMother() == -1) {
-// vertex[0] += particle->Vx();
-// vertex[1] += particle->Vy();
-// vertex[2] += particle->Vz();
-// nPrimary++;
-// }
-// if (nPrimary) {
-// vertex[0] /= (double)nPrimary;
-// vertex[1] /= (double)nPrimary;
-// vertex[2] /= (double)nPrimary;
-// }
-// }
-// }
+ if (esdVert->GetNContributors()) {
+ esdVert->GetXYZ(vertex);
+ printf("find vertex\n");
+ }
// setting ESD MUON class
AliESDMuonTrack* theESDTrack = new AliESDMuonTrack() ;
recTrack = (AliMUONTrack*) recTracksArray->At(iRecTracks);
trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First();
- trackParam->ExtrapToVertex(vertex[0],vertex[1],vertex[2]);
+
+ if (esdVert->GetNContributors())
+ AliMUONTrackExtrap::ExtrapToVertex(trackParam, vertex[0],vertex[1],vertex[2]);
bendingSlope = trackParam->GetBendingSlope();
nonBendingSlope = trackParam->GetNonBendingSlope();
- inverseBendingMomentum = trackParam->GetInverseBendingMomentum();
+ inverseBendingMomentum = trackParam->GetInverseBendingMomentum();
xRec = trackParam->GetNonBendingCoor();
yRec = trackParam->GetBendingCoor();
zRec = trackParam->GetZ();
esd->AddMuonTrack(theESDTrack);
} // end loop tracks
- // add global trigger pattern
- if (nRecTracks != 0)
- esd->SetTrigger(trigPat);
-
// reset muondata
muonData->ResetRecTracks();
muonData->ResetRecTriggerTracks();
//} // end loop on event
loader->UnloadTracks();
- // if (!header)
-// runLoader->UnloadKinematics();
+
delete theESDTrack;
delete muonData;
- // delete particle;
}//_____________________________________________________________________________
void AliMUONReconstructor::FillESD(AliRunLoader* runLoader, AliRawReader* /*rawReader*/, AliESD* esd) const
{
+/// Fill ESD
+/// \todo add more
+
// don't need rawReader ???
FillESD(runLoader, esd);
}