* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id$ */
-
//_________________________________________________________________________
// Base class for the clusterization algorithm (pure abstract)
//*--
//*-- Author: Yves Schutz SUBATECH
//////////////////////////////////////////////////////////////////////////////
-// --- ROOT system ---
-
-// --- Standard library ---
+#include <TClonesArray.h>
+#include <TTree.h>
-// --- AliRoot header files ---
#include "AliPHOSClusterizer.h"
-#include "AliPHOSGetter.h"
-#include "AliPHOSQualAssDataMaker.h"
-
-// --- AliRoot header files ---
#include "AliPHOSQualAssDataMaker.h"
+#include "AliPHOSDigit.h"
ClassImp(AliPHOSClusterizer)
//____________________________________________________________________________
AliPHOSClusterizer::AliPHOSClusterizer():
- TTask("",""),
- fEventFolderName(""),
- fFirstEvent(0),
- fLastEvent(-1),
- fRawReader(0),
- fQADM(0)
+ fGeom(NULL),
+ fQADM(0),
+ fDigitsArr(0),
+ fTreeR(0),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
- // ctor
+ // ctor
}
//____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const TString alirunFileName,
- const TString eventFolderName):
- TTask("PHOS"+AliConfig::Instance()->GetReconstructionerTaskName(),
- alirunFileName), fEventFolderName(eventFolderName),
- fFirstEvent(0),
- fLastEvent(-1),
- fRawReader(0),
- fQADM(0)
+AliPHOSClusterizer::AliPHOSClusterizer(AliPHOSGeometry *geom):
+ fGeom(geom),
+ fQADM(0),
+ fDigitsArr(0),
+ fTreeR(0),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
// ctor
fQADM = new AliPHOSQualAssDataMaker() ;
fQADM ->Init(AliQualAss::kRECPOINTS) ;
}
-//____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer) :
- TTask(clusterizer),fEventFolderName(clusterizer.GetEventFolderName()),
- fFirstEvent(clusterizer.GetFirstEvent()),fLastEvent(clusterizer.GetLastEvent()),
- fRawReader(clusterizer.GetRawReader()),
- fQADM(clusterizer.GetQualAssDataMaker())
-{
- //Copy constructor
- //initiaizes the quality assurance data maker
- GetQualAssDataMaker()->Init(AliQualAss::kRECPOINTS) ;
-}
//____________________________________________________________________________
AliPHOSClusterizer::~AliPHOSClusterizer()
{
// dtor
-
- //Remove this from the parental task before destroying
- if(AliPHOSGetter::Instance()->PhosLoader())
- AliPHOSGetter::Instance()->PhosLoader()->CleanReconstructioner();
delete fQADM ;
+ if (fDigitsArr) {
+ fDigitsArr->Delete();
+ delete fDigitsArr;
+ }
+ if (fEMCRecPoints) {
+ fEMCRecPoints->Delete();
+ delete fEMCRecPoints;
+ }
+ if (fCPVRecPoints) {
+ fCPVRecPoints->Delete();
+ delete fCPVRecPoints;
+ }
}
+//____________________________________________________________________________
+void AliPHOSClusterizer::SetInput(TTree * digitsTree)
+{
+ // Get the tree with digits and sets
+ // the input array with digits for PHOS
+ TBranch *branch = digitsTree->GetBranch("PHOS");
+ if (!branch) {
+ AliError("can't get the branch with the PHOS digits !");
+ return;
+ }
+ fDigitsArr = new TClonesArray("AliPHOSDigit",100);
+ branch->SetAddress(&fDigitsArr);
+ branch->GetEntry(0);
+}
+
+//____________________________________________________________________________
+void AliPHOSClusterizer::SetOutput(TTree * clustersTree)
+{
+ // Set the output clusters tree,
+ // creates the arrays for EMC and CPV,
+ // and set the corresponding branch addresses
+ fTreeR = clustersTree;
+ AliDebug(9, "Making array for EMC clusters");
+ fEMCRecPoints = new TObjArray(100) ;
+ fEMCRecPoints->SetName("EMCRECPOINTS") ;
+ Int_t split = 0;
+ Int_t bufsize = 32000;
+ fTreeR->Branch("PHOSEmcRP", "TObjArray", &fEMCRecPoints, bufsize, split);
+
+ AliDebug(9, "Making array for CPV clusters");
+ fCPVRecPoints = new TObjArray(100) ;
+ fCPVRecPoints->SetName("CPVRECPOINTS") ;
+ fTreeR->Branch("PHOSCpvRP", "TObjArray", &fCPVRecPoints, bufsize, split);
+}
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-/* $Id$ */
-
/* History of cvs commits:
*
* $Log$
+ * Revision 1.41 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.40 2006/08/25 16:56:30 kharlov
* Compliance with Effective C++
*
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
// --- ROOT system ---
+#include <TObject.h>
-#include "TTask.h"
-class TFile ;
-
-// --- Standard library ---
+class TTree;
-// --- AliRoot header files ---
-#include "AliConfig.h"
-#include "AliRawReaderFile.h"
+class AliPHOSGeometry;
class AliPHOSQualAssDataMaker ;
-class AliPHOSClusterizer : public TTask {
+class AliPHOSClusterizer : public TObject {
public:
AliPHOSClusterizer() ; // default ctor
- AliPHOSClusterizer(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
- AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer);
+ AliPHOSClusterizer(AliPHOSGeometry *geom);
virtual ~AliPHOSClusterizer() ; // dtor
- virtual Float_t GetEmcClusteringThreshold()const {Warning("GetEmcClusteringThreshold", "Not Defined" ) ; return 0. ; }
- virtual Float_t GetEmcLocalMaxCut()const {Warning("GetEmcLocalMaxCut", "Not Defined" ) ; return 0. ; }
- virtual Float_t GetEmcLogWeight()const {Warning("GetEmcLogWeight", "Not Defined" ) ; return 0. ; }
- virtual Float_t GetEmcTimeGate() const {Warning("GetEmcTimeGate", "Not Defined" ) ; return 0. ; } ;
- virtual Float_t GetCpvClusteringThreshold()const {Warning("GetCpvClusteringThreshold", "Not Defined" ) ; return 0. ; }
- virtual Float_t GetCpvLocalMaxCut()const {Warning("GetCpvLocalMaxCut", "Not Defined" ) ; return 0. ; }
- virtual Float_t GetCpvLogWeight()const {Warning("GetCpvLogWeight", "Not Defined" ) ; return 0. ; }
- virtual Int_t GetRecPointsInRun() const {Warning("GetRecPointsInRun", "Not Defined" ) ; return 0 ; }
-
- virtual void MakeClusters() {Warning("MakeClusters", "Not Defined" ) ; }
- virtual void Print(const Option_t * = "")const {Warning("Print", "Not Defined" ) ; }
+
+ virtual void Digits2Clusters(Option_t *option) = 0;
+ virtual Float_t GetEmcClusteringThreshold()const = 0;
+ virtual Float_t GetEmcLocalMaxCut()const = 0;
+ virtual Float_t GetEmcLogWeight()const = 0;
+ virtual Float_t GetEmcTimeGate() const = 0;
+ virtual Float_t GetCpvClusteringThreshold()const = 0;
+ virtual Float_t GetCpvLocalMaxCut()const = 0;
+ virtual Float_t GetCpvLogWeight()const = 0;
+
+ virtual void Print(const Option_t * = "") const = 0;
virtual void SetEmcClusteringThreshold(Float_t) = 0;
virtual void SetEmcLocalMaxCut(Float_t ) = 0;
virtual void SetCpvLocalMaxCut(Float_t) = 0;
virtual void SetCpvLogWeight(Float_t) = 0;
virtual void SetUnfolding(Bool_t) = 0;
- void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
- void SetEventFolderName(TString name) { fEventFolderName = name ; }
- void SetRawReader(AliRawReader *reader) {fRawReader = reader;}
- TString GetEventFolderName() const {return fEventFolderName;}
- Int_t GetFirstEvent() const {return fFirstEvent; }
- Int_t GetLastEvent() const {return fLastEvent; }
- AliRawReader *GetRawReader() const {return fRawReader; }
+ virtual const char * Version() const = 0;
- AliPHOSClusterizer & operator = (const AliPHOSClusterizer & /*rvalue*/) {return *this ;}
-
- virtual const char * Version() const {Warning("Version", "Not Defined" ) ; return 0 ; }
+ virtual void SetInput(TTree *digitsTree);
+ virtual void SetOutput(TTree *clustersTree);
protected:
AliPHOSQualAssDataMaker * GetQualAssDataMaker() const { return fQADM ; }
- TString fEventFolderName ; // event folder name
- Int_t fFirstEvent; // first event to process
- Int_t fLastEvent; // last event to process
- AliRawReader *fRawReader; //! reader of raw data
-
+ AliPHOSGeometry *fGeom; // Pointer to PHOS geometry
AliPHOSQualAssDataMaker * fQADM ; //!Quality Assurance Data Maker
+ TClonesArray *fDigitsArr; // Array with input digits
+ TTree *fTreeR; // Tree with output clusters
+ TObjArray *fEMCRecPoints; // Array with EMC clusters
+ TObjArray *fCPVRecPoints; // Array with CPV clusters
+
+private:
+ AliPHOSClusterizer(const AliPHOSClusterizer & clusterizer);
+ AliPHOSClusterizer & operator = (const AliPHOSClusterizer &clusterer);
- ClassDef(AliPHOSClusterizer,4) // Clusterization algorithm class
+ ClassDef(AliPHOSClusterizer,5) // Clusterization algorithm class
} ;
/* History of cvs commits:
*
* $Log$
+ * Revision 1.112 2007/08/22 09:20:50 hristov
+ * Updated QA classes (Yves)
+ *
* Revision 1.111 2007/08/08 12:11:28 kharlov
* Protection against uninitialized fQADM
*
// This TTask is normally called from Reconstructioner, but can as well be used in
// standalone mode.
// Use Case:
-// root [0] AliPHOSClusterizerv1 * cl = new AliPHOSClusterizerv1("galice.root", "recpointsname", "digitsname")
-// Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
-// // reads gAlice from header file "galice.root", uses digits stored in the branch names "digitsname" (default = "Default")
-// // and saves recpoints in branch named "recpointsname" (default = "digitsname")
-// root [1] cl->ExecuteTask()
-// //finds RecPoints in all events stored in galice.root
+// root [0] AliPHOSClusterizerv1 * cl = new AliPHOSClusterizerv1(<pointer_to_phos_geometry_onject>)
+// root [1] cl->Digits2Clusters(digitsTree,clusterTree)
+// //finds RecPoints in the current event
// root [2] cl->SetDigitsBranch("digits2")
// //sets another title for Digitis (input) branch
// root [3] cl->SetRecPointsBranch("recp2")
// //sets another title four output branches
// root [4] cl->SetEmcLocalMaxCut(0.03)
// //set clusterization parameters
-// root [5] cl->ExecuteTask("deb all time")
-// //once more finds RecPoints options are
-// // deb - print number of found rec points
-// // deb all - print number of found RecPoints and some their characteristics
-// // time - print benchmarking results
// --- ROOT system ---
#include "TMinuit.h"
#include "TTree.h"
#include "TBenchmark.h"
+#include "TClonesArray.h"
// --- Standard library ---
// --- AliRoot header files ---
#include "AliLog.h"
-#include "AliRunLoader.h"
-#include "AliGenerator.h"
-#include "AliPHOSGetter.h"
+#include "AliConfig.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSClusterizerv1.h"
#include "AliPHOSEmcRecPoint.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
-#include "AliPHOSReconstructor.h"
#include "AliPHOSRecoParam.h"
#include "AliPHOSQualAssDataMaker.h"
+#include "AliPHOSCalibData.h"
+#include "AliPHOSReconstructor.h"
ClassImp(AliPHOSClusterizerv1)
fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0),
fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fRecPointsInRun(0), fEmcTimeGate(0),
- fIsOldRCUFormat(0), fEventCounter(0)
+ fW0CPV(0), fEmcTimeGate(0),
+ fIsOldRCUFormat(0)
{
// default ctor (to be used mainly by Streamer)
}
//____________________________________________________________________________
-AliPHOSClusterizerv1::AliPHOSClusterizerv1(const TString alirunFileName, const TString eventFolderName) :
- AliPHOSClusterizer(alirunFileName, eventFolderName),
+AliPHOSClusterizerv1::AliPHOSClusterizerv1(AliPHOSGeometry *geom) :
+ AliPHOSClusterizer(geom),
fDefaultInit(0), fEmcCrystals(0), fToUnfold(0),
fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
fCalibData(0), fADCchanelEmc(0), fADCpedestalEmc(0),
fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0),
fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fRecPointsInRun(0), fEmcTimeGate(0),
- fIsOldRCUFormat(0), fEventCounter(0)
+ fW0CPV(0), fEmcTimeGate(0),
+ fIsOldRCUFormat(0)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
fDefaultInit = kFALSE ;
}
-//____________________________________________________________________________
-AliPHOSClusterizerv1::AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & obj) :
- AliPHOSClusterizer(obj),
- fDefaultInit(0), fEmcCrystals(0), fToUnfold(0),
- fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
- fCalibData(0), fADCchanelEmc(0), fADCpedestalEmc(0),
- fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0),
- fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0),
- fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fRecPointsInRun(0), fEmcTimeGate(0),
- fIsOldRCUFormat(0), fEventCounter(0)
-{
- // Copy constructor
-}
//____________________________________________________________________________
AliPHOSClusterizerv1::~AliPHOSClusterizerv1()
{
// dtor
}
-//____________________________________________________________________________
-const TString AliPHOSClusterizerv1::BranchName() const
-{
- return GetName();
-}
-
+
//____________________________________________________________________________
Float_t AliPHOSClusterizerv1::CalibrateEMC(Float_t amp, Int_t absId)
{
if(fCalibData){
Int_t relId[4];
- AliPHOSGetter *gime = AliPHOSGetter::Instance();
- gime->PHOSGeometry()->AbsToRelNumbering(absId,relId) ;
+ fGeom->AbsToRelNumbering(absId,relId) ;
Int_t module = relId[0];
Int_t column = relId[3];
Int_t row = relId[2];
if(fCalibData){
Int_t relId[4];
- AliPHOSGetter *gime = AliPHOSGetter::Instance();
- gime->PHOSGeometry()->AbsToRelNumbering(absId,relId) ;
+ fGeom->AbsToRelNumbering(absId,relId) ;
Int_t module = relId[0];
Int_t column = relId[3];
Int_t row = relId[2];
}
//____________________________________________________________________________
-void AliPHOSClusterizerv1::Exec(Option_t *option)
+void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option)
{
- // Steering method to perform clusterization for events
- // in the range from fFirstEvent to fLastEvent.
- // This range is optionally set by SetEventRange().
- // if fLastEvent=-1 (by default), then process events until the end.
+ // Steering method to perform clusterization for one event
+ // The input is the tree with digits.
+ // The output is the tree with clusters.
if(strstr(option,"tim"))
gBenchmark->Start("PHOSClusterizer");
GetCalibrationParameters() ;
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- if (fRawReader == 0)
- gime->SetRawDigits(kFALSE);
- else
- gime->SetRawDigits(kTRUE);
-
- if (fLastEvent == -1)
- fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fFirstEvent, gime->MaxEvent()); // one event at the time
- Int_t nEvents = fLastEvent - fFirstEvent + 1;
-
- Int_t ievent ;
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- fEventCounter++ ;
- if (fRawReader == 0)
- gime->Event(ievent ,"D"); // Read digits from simulated data
- else {
- AliRunLoader * rl = AliRunLoader::GetRunLoader(gime->PhosLoader()->GetTitle());
- rl->GetEvent(ievent);
- gime->Event(fRawReader,"W",fIsOldRCUFormat); // Read digits from raw data
- }
- fNumberOfEmcClusters = fNumberOfCpvClusters = 0 ;
+ MakeClusters() ;
- MakeClusters() ;
-
- AliDebug(2,Form(" ---- Printing clusters (%d) of event %d.\n",
- gime->EmcRecPoints()->GetEntries(),ievent));
- if(AliLog::GetGlobalDebugLevel()>1)
- gime->EmcRecPoints()->Print();
+ AliDebug(2,Form(" ---- Printing clusters (%d)\n",
+ fEMCRecPoints->GetEntries()));
+ if(AliLog::GetGlobalDebugLevel()>1)
+ fEMCRecPoints->Print();
- if(fToUnfold)
- MakeUnfolding() ;
+ if(fToUnfold)
+ MakeUnfolding();
//makes the quality assurance data
- if (GetQualAssDataMaker()) {
- GetQualAssDataMaker()->SetData(gime->EmcRecPoints()) ;
- GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
- GetQualAssDataMaker()->SetData(gime->CpvRecPoints()) ;
- GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
- }
+ if (GetQualAssDataMaker()) {
+ GetQualAssDataMaker()->SetData(fEMCRecPoints) ;
+ GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
+ GetQualAssDataMaker()->SetData(fCPVRecPoints) ;
+ GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
+ }
- WriteRecPoints();
+ WriteRecPoints();
- if(strstr(option,"deb"))
- PrintRecPoints(option) ;
+ if(strstr(option,"deb"))
+ PrintRecPoints(option) ;
- //increment the total number of recpoints per run
- fRecPointsInRun += gime->EmcRecPoints()->GetEntriesFast() ;
- fRecPointsInRun += gime->CpvRecPoints()->GetEntriesFast() ;
- }
-
+ // PLEASE FIX BY MOVING IT TO ALIRECONSTRUCTION !!!
//Write the quality assurance data only after the last event
- if (GetQualAssDataMaker() && fEventCounter == gime->MaxEvent())
- GetQualAssDataMaker()->Finish(AliQualAss::kRECPOINTS) ;
+ // if (GetQualAssDataMaker() && fEventCounter == gime->MaxEvent())
+ // GetQualAssDataMaker()->Finish(AliQualAss::kRECPOINTS) ;
- if(fWrite) //do not unload in "on flight" mode
- Unload();
-
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSClusterizer");
- AliInfo(Form("took %f seconds for Clusterizing %f seconds per event \n",
- gBenchmark->GetCpuTime("PHOSClusterizer"),
- gBenchmark->GetCpuTime("PHOSClusterizer")/nEvents )) ;
+ AliInfo(Form("took %f seconds for Clusterizing\n",
+ gBenchmark->GetCpuTime("PHOSClusterizer")));
}
}
// Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
- TClonesArray * digits = gime->Digits();
-
gMinuit->mncler(); // Reset Minuit's list of paramters
gMinuit->SetPrintLevel(-1) ; // No Printout
gMinuit->SetFCN(AliPHOSClusterizerv1::UnfoldingChiSquare) ;
TList * toMinuit = new TList();
toMinuit->AddAt(emcRP,0) ;
- toMinuit->AddAt(digits,1) ;
+ toMinuit->AddAt(fDigitsArr,1) ;
+ toMinuit->AddAt(fGeom,2) ;
gMinuit->SetObjectFit(toMinuit) ; // To tranfer pointer to UnfoldingChiSquare
Int_t iDigit ;
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
for(iDigit = 0; iDigit < nDigits; iDigit++){
digit = maxAt[iDigit];
Int_t relid[4] ;
Float_t x = 0.;
Float_t z = 0.;
- geom->AbsToRelNumbering(digit->GetId(), relid) ;
- geom->RelPosInModule(relid, x, z) ;
+ fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ fGeom->RelPosInModule(relid, x, z) ;
Float_t energy = maxAtEnergy[iDigit] ;
// Make all memory allocations which can not be done in default constructor.
// Attach the Clusterizer task to the list of PHOS tasks
- AliPHOSGetter* gime = AliPHOSGetter::Instance() ;
- if(!gime)
- gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data());
-
- AliPHOSGeometry * geom = gime->PHOSGeometry();
-
- fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
+ fEmcCrystals = fGeom->GetNModules() * fGeom->GetNCristalsInModule() ;
if(!gMinuit)
gMinuit = new TMinuit(100);
- if ( !gime->Clusterizer() ) {
- gime->PostClusterizer(this);
- }
}
//____________________________________________________________________________
fToUnfold = kTRUE ;
- fRecPointsInRun = 0 ;
-
fWrite = kTRUE ;
fCalibData = 0 ;
- SetEventRange(0,-1) ;
-
fIsOldRCUFormat = kFALSE;
}
// The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
// which is compared to a digit (d2) not yet in a cluster
- AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
-
Int_t rv = 0 ;
Int_t relid1[4] ;
- geom->AbsToRelNumbering(d1->GetId(), relid1) ;
+ fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
Int_t relid2[4] ;
- geom->AbsToRelNumbering(d2->GetId(), relid2) ;
+ fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module
Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(i) ) ;
digit->SetIndexInList(i) ;
}
-
- //Overwrite digits tree
- AliPHOSGetter* gime = AliPHOSGetter::Instance();
- TTree * treeD = gime->TreeD();
- treeD->Branch("PHOS", &digits);
- treeD->Fill() ;
- gime->WriteDigits("OVERWRITE");
- gime->PhosLoader()->UnloadDigits() ;
}
+
//____________________________________________________________________________
Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const
{
// Tells if (true) or not (false) the digit is in a PHOS-EMC module
Bool_t rv = kFALSE ;
- AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
- Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
+ Int_t nEMC = fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ();
if(digit->GetId() <= nEMC ) rv = kTRUE;
Bool_t rv = kFALSE ;
- AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
-
- Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
+ Int_t nEMC = fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ();
if(digit->GetId() > nEMC ) rv = kTRUE;
return rv ;
}
-//____________________________________________________________________________
-void AliPHOSClusterizerv1::Unload()
-{
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- gime->PhosLoader()->UnloadDigits() ;
- gime->PhosLoader()->UnloadRecPoints() ;
-}
-
//____________________________________________________________________________
void AliPHOSClusterizerv1::WriteRecPoints()
{
// Creates new branches with given title
// fills and writes into TreeR.
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * digits = gime->Digits() ;
-
Int_t index ;
//Evaluate position, dispersion and other RecPoint properties..
- Int_t nEmc = emcRecPoints->GetEntriesFast();
+ Int_t nEmc = fEMCRecPoints->GetEntriesFast();
for(index = 0; index < nEmc; index++){
AliPHOSEmcRecPoint * rp =
- dynamic_cast<AliPHOSEmcRecPoint *>( emcRecPoints->At(index) );
+ dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(index) );
rp->Purify(fEmcMinE) ;
if(rp->GetMultiplicity()==0){
- emcRecPoints->RemoveAt(index) ;
+ fEMCRecPoints->RemoveAt(index) ;
delete rp ;
continue;
}
// No vertex is available now, calculate corrections in PID
- rp->EvalAll(fW0,digits) ;
+ rp->EvalAll(fW0,fDigitsArr) ;
TVector3 fakeVtx(0.,0.,0.) ;
- rp->EvalAll(fW0,fakeVtx,digits) ;
+ rp->EvalAll(fW0,fakeVtx,fDigitsArr) ;
rp->EvalLocal2TrackingCSTransform();
}
- emcRecPoints->Compress() ;
-// emcRecPoints->Sort() ; //Can not sort until position is calculated!
- // emcRecPoints->Expand(emcRecPoints->GetEntriesFast()) ;
- for(index = 0; index < emcRecPoints->GetEntries(); index++){
- dynamic_cast<AliPHOSEmcRecPoint *>( emcRecPoints->At(index) )->SetIndexInList(index) ;
+ fEMCRecPoints->Compress() ;
+ // fEMCRecPoints->Sort() ; //Can not sort until position is calculated!
+ // fEMCRecPoints->Expand(fEMCRecPoints->GetEntriesFast()) ;
+ for(index = 0; index < fEMCRecPoints->GetEntries(); index++){
+ dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(index) )->SetIndexInList(index) ;
}
//For each rec.point set the distance to the nearest bad crystal (BVP)
SetDistancesToBadChannels();
//Now the same for CPV
- for(index = 0; index < cpvRecPoints->GetEntries(); index++){
- AliPHOSCpvRecPoint * rp = dynamic_cast<AliPHOSCpvRecPoint *>( cpvRecPoints->At(index) );
- rp->EvalAll(fW0CPV,digits) ;
+ for(index = 0; index < fCPVRecPoints->GetEntries(); index++){
+ AliPHOSCpvRecPoint * rp = dynamic_cast<AliPHOSCpvRecPoint *>( fCPVRecPoints->At(index) );
+ rp->EvalAll(fW0CPV,fDigitsArr) ;
rp->EvalLocal2TrackingCSTransform();
}
-// cpvRecPoints->Sort() ;
+// fCPVRecPoints->Sort() ;
- for(index = 0; index < cpvRecPoints->GetEntries(); index++)
- dynamic_cast<AliPHOSCpvRecPoint *>( cpvRecPoints->At(index) )->SetIndexInList(index) ;
+ for(index = 0; index < fCPVRecPoints->GetEntries(); index++)
+ dynamic_cast<AliPHOSCpvRecPoint *>( fCPVRecPoints->At(index) )->SetIndexInList(index) ;
- cpvRecPoints->Expand(cpvRecPoints->GetEntriesFast()) ;
+ fCPVRecPoints->Expand(fCPVRecPoints->GetEntriesFast()) ;
if(fWrite){ //We write TreeR
- TTree * treeR = gime->TreeR();
-
- Int_t bufferSize = 32000 ;
- Int_t splitlevel = 0 ;
-
- //First EMC
- TBranch * emcBranch = treeR->Branch("PHOSEmcRP","TObjArray",&emcRecPoints,bufferSize,splitlevel);
- emcBranch->SetTitle(BranchName());
-
- //Now CPV branch
- TBranch * cpvBranch = treeR->Branch("PHOSCpvRP","TObjArray",&cpvRecPoints,bufferSize,splitlevel);
- cpvBranch->SetTitle(BranchName());
-
- emcBranch ->Fill() ;
- cpvBranch ->Fill() ;
-
- gime->WriteRecPoints("OVERWRITE");
- gime->WriteClusterizer("OVERWRITE");
+ fTreeR->Fill();
}
}
// Steering method to construct the clusters stored in a list of Reconstructed Points
// A cluster is defined as a list of neighbour digits
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
-
- emcRecPoints->Delete() ;
- cpvRecPoints->Delete() ;
-
- TClonesArray * digits = gime->Digits() ;
-
//Remove digits below threshold
- CleanDigits(digits) ;
+ CleanDigits(fDigitsArr) ;
- TClonesArray * digitsC = static_cast<TClonesArray*>( digits->Clone() ) ;
+ TClonesArray * digitsC = static_cast<TClonesArray*>( fDigitsArr->Clone() ) ;
// Clusterization starts
if ( IsInEmc(digit) ) {
// start a new EMC RecPoint
- if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
- emcRecPoints->Expand(2*fNumberOfEmcClusters+1) ;
+ if(fNumberOfEmcClusters >= fEMCRecPoints->GetSize())
+ fEMCRecPoints->Expand(2*fNumberOfEmcClusters+1) ;
- emcRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ;
- clu = dynamic_cast<AliPHOSEmcRecPoint *>( emcRecPoints->At(fNumberOfEmcClusters) ) ;
+ fEMCRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ;
+ clu = dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(fNumberOfEmcClusters) ) ;
fNumberOfEmcClusters++ ;
clu->AddDigit(*digit, CalibrateEMC(digit->GetEnergy(),digit->GetId())) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
} else {
// start a new CPV cluster
- if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
- cpvRecPoints->Expand(2*fNumberOfCpvClusters+1);
+ if(fNumberOfCpvClusters >= fCPVRecPoints->GetSize())
+ fCPVRecPoints->Expand(2*fNumberOfCpvClusters+1);
- cpvRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ;
+ fCPVRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ;
- clu = dynamic_cast<AliPHOSCpvRecPoint *>( cpvRecPoints->At(fNumberOfCpvClusters) ) ;
+ clu = dynamic_cast<AliPHOSCpvRecPoint *>( fCPVRecPoints->At(fNumberOfCpvClusters) ) ;
fNumberOfCpvClusters++ ;
clu->AddDigit(*digit, CalibrateCPV(digit->GetAmp(),digit->GetId()) ) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
AliPHOSDigit * digitN ;
index = 0 ;
while (index < iDigitInCluster){ // scan over digits already in cluster
- digit = dynamic_cast<AliPHOSDigit*>( digits->At(clusterdigitslist[index]) ) ;
+ digit = dynamic_cast<AliPHOSDigit*>( fDigitsArr->At(clusterdigitslist[index]) ) ;
index++ ;
while ( (digitN = dynamic_cast<AliPHOSDigit *>( nextdigit() ) ) ) { // scan over the reduced list of digits
Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
// Unfolds clusters using the shape of an ElectroMagnetic shower
// Performs unfolding of all EMC/CPV clusters
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
-
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * digits = gime->Digits() ;
-
// Unfold first EMC clusters
if(fNumberOfEmcClusters > 0){
- Int_t nModulesToUnfold = geom->GetNModules() ;
+ Int_t nModulesToUnfold = fGeom->GetNModules() ;
Int_t numberofNotUnfolded = fNumberOfEmcClusters ;
Int_t index ;
for(index = 0 ; index < numberofNotUnfolded ; index++){
- AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast<AliPHOSEmcRecPoint *>( emcRecPoints->At(index) ) ;
+ AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(index) ) ;
if(emcRecPoint->GetPHOSMod()> nModulesToUnfold)
break ;
Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
AliPHOSDigit ** maxAt = new AliPHOSDigit*[nMultipl] ;
Float_t * maxAtEnergy = new Float_t[nMultipl] ;
- Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,digits) ;
+ Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,fDigitsArr) ;
if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
- emcRecPoints->Remove(emcRecPoint);
- emcRecPoints->Compress() ;
+ fEMCRecPoints->Remove(emcRecPoint);
+ fEMCRecPoints->Compress() ;
index-- ;
fNumberOfEmcClusters -- ;
numberofNotUnfolded-- ;
// Unfold now CPV clusters
if(fNumberOfCpvClusters > 0){
- Int_t nModulesToUnfold = geom->GetNModules() ;
+ Int_t nModulesToUnfold = fGeom->GetNModules() ;
Int_t numberofCpvNotUnfolded = fNumberOfCpvClusters ;
Int_t index ;
for(index = 0 ; index < numberofCpvNotUnfolded ; index++){
- AliPHOSRecPoint * recPoint = dynamic_cast<AliPHOSRecPoint *>( cpvRecPoints->At(index) ) ;
+ AliPHOSRecPoint * recPoint = dynamic_cast<AliPHOSRecPoint *>( fCPVRecPoints->At(index) ) ;
if(recPoint->GetPHOSMod()> nModulesToUnfold)
break ;
Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
AliPHOSDigit ** maxAt = new AliPHOSDigit*[nMultipl] ;
Float_t * maxAtEnergy = new Float_t[nMultipl] ;
- Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,digits) ;
+ Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,fDigitsArr) ;
if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
- cpvRecPoints->Remove(emcRecPoint);
- cpvRecPoints->Compress() ;
+ fCPVRecPoints->Remove(emcRecPoint);
+ fCPVRecPoints->Compress() ;
index-- ;
numberofCpvNotUnfolded-- ;
fNumberOfCpvClusters-- ;
{
// Performs the unfolding of a cluster with nMax overlapping showers
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
-
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
- const TClonesArray * digits = gime->Digits() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
-
Int_t nPar = 3 * nMax ;
Float_t * fitparameters = new Float_t[nPar] ;
Int_t iparam ;
Int_t iDigit ;
for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
- digit = dynamic_cast<AliPHOSDigit*>( digits->At(emcDigits[iDigit] ) ) ;
- geom->AbsToRelNumbering(digit->GetId(), relid) ;
- geom->RelPosInModule(relid, xDigit, zDigit) ;
+ digit = dynamic_cast<AliPHOSDigit*>( fDigitsArr->At(emcDigits[iDigit] ) ) ;
+ fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ fGeom->RelPosInModule(relid, xDigit, zDigit) ;
efit[iDigit] = 0;
iparam = 0 ;
zpar = fitparameters[iparam+1] ;
epar = fitparameters[iparam+2] ;
iparam += 3 ;
-// geom->GetIncidentVector(fVtx,relid[0],xpar,zpar,vIncid) ;
+// fGeom->GetIncidentVector(fVtx,relid[0],xpar,zpar,vIncid) ;
// efit[iDigit] += epar * ShowerShape(xDigit - xpar,zDigit - zpar,vIncid) ;
efit[iDigit] += epar * ShowerShape(xDigit - xpar,zDigit - zpar) ;
}
zpar = fitparameters[iparam+1] ;
epar = fitparameters[iparam+2] ;
iparam += 3 ;
-// geom->GetIncidentVector(fVtx,iniEmc->GetPHOSMod(),xpar,zpar,vIncid) ;
+// fGeom->GetIncidentVector(fVtx,iniEmc->GetPHOSMod(),xpar,zpar,vIncid) ;
AliPHOSEmcRecPoint * emcRP = 0 ;
- if(iniEmc->IsEmc()){ //create new entries in fEmcRecPoints...
+ if(iniEmc->IsEmc()){ //create new entries in fEMCRecPoints...
- if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
- emcRecPoints->Expand(2*fNumberOfEmcClusters) ;
+ if(fNumberOfEmcClusters >= fEMCRecPoints->GetSize())
+ fEMCRecPoints->Expand(2*fNumberOfEmcClusters) ;
- (*emcRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint("") ;
- emcRP = dynamic_cast<AliPHOSEmcRecPoint *>( emcRecPoints->At(fNumberOfEmcClusters) ) ;
+ (*fEMCRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint("") ;
+ emcRP = dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(fNumberOfEmcClusters) ) ;
fNumberOfEmcClusters++ ;
emcRP->SetNExMax((Int_t)nPar/3) ;
}
- else{//create new entries in fCpvRecPoints
- if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
- cpvRecPoints->Expand(2*fNumberOfCpvClusters) ;
+ else{//create new entries in fCPVRecPoints
+ if(fNumberOfCpvClusters >= fCPVRecPoints->GetSize())
+ fCPVRecPoints->Expand(2*fNumberOfCpvClusters) ;
- (*cpvRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint("") ;
- emcRP = dynamic_cast<AliPHOSEmcRecPoint *>( cpvRecPoints->At(fNumberOfCpvClusters) ) ;
+ (*fCPVRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint("") ;
+ emcRP = dynamic_cast<AliPHOSEmcRecPoint *>( fCPVRecPoints->At(fNumberOfCpvClusters) ) ;
fNumberOfCpvClusters++ ;
}
Float_t eDigit ;
for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
- digit = dynamic_cast<AliPHOSDigit*>( digits->At( emcDigits[iDigit] ) ) ;
- geom->AbsToRelNumbering(digit->GetId(), relid) ;
- geom->RelPosInModule(relid, xDigit, zDigit) ;
+ digit = dynamic_cast<AliPHOSDigit*>( fDigitsArr->At( emcDigits[iDigit] ) ) ;
+ fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ fGeom->RelPosInModule(relid, xDigit, zDigit) ;
// ratio = epar * ShowerShape(xDigit - xpar,zDigit - zpar,vIncid) / efit[iDigit] ;
ratio = epar * ShowerShape(xDigit - xpar,zDigit - zpar) / efit[iDigit] ;
eDigit = emcEnergies[iDigit] * ratio ;
AliPHOSEmcRecPoint * emcRP = dynamic_cast<AliPHOSEmcRecPoint*>( toMinuit->At(0) ) ;
TClonesArray * digits = dynamic_cast<TClonesArray*>( toMinuit->At(1) ) ;
-// TVector3 * vtx = dynamic_cast<TVector3*>(toMinuit->At(2)) ; //Vertex position
+ // A bit buggy way to get an access to the geometry
+ // To be revised!
+ AliPHOSGeometry *geom = dynamic_cast<AliPHOSGeometry *>(toMinuit->At(2));
+
+// TVector3 * vtx = dynamic_cast<TVector3*>(toMinuit->At(3)) ; //Vertex position
// AliPHOSEmcRecPoint * emcRP = dynamic_cast<AliPHOSEmcRecPoint *>( gMinuit->GetObjectFit() ) ; // EmcRecPoint to fit
Float_t * emcEnergies = emcRP->GetEnergiesList() ;
- const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
// TVector3 vInc ;
fret = 0. ;
Int_t iparam ;
iParam++ ;
Double_t dz = (zDigit - x[iParam]) ;
iParam++ ;
-// geom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),x[iParam-2],x[iParam-1],vInc) ;
+// fGeom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),x[iParam-2],x[iParam-1],vInc) ;
// efit += x[iParam] * ShowerShape(dx,dz,vInc) ;
efit += x[iParam] * ShowerShape(dx,dz) ;
iParam++ ;
Double_t xpar = x[iParam] ;
Double_t zpar = x[iParam+1] ;
Double_t epar = x[iParam+2] ;
-// geom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),xpar,zpar,vInc) ;
+// fGeom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),xpar,zpar,vInc) ;
Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) );
// Double_t shape = sum * ShowerShape(xDigit - xpar,zDigit - zpar,vInc) ;
Double_t shape = sum * ShowerShape(xDigit - xpar,zDigit - zpar) ;
Double_t zpar = x[iparam+1] ;
Double_t epar = x[iparam+2] ;
iparam += 3 ;
-// geom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),xpar,zpar,vInc) ;
+// fGeom->GetIncidentVector(*vtx,emcRP->GetPHOSMod(),xpar,zpar,vInc) ;
// efit += epar * ShowerShape(xDigit - xpar,zDigit - zpar,vInc) ;
efit += epar * ShowerShape(xDigit - xpar,zDigit - zpar) ;
}
{
// Prints list of RecPoints produced at the current pass of AliPHOSClusterizer
- AliPHOSGetter * gime = AliPHOSGetter::Instance();
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
-
- AliInfo(Form("\nevent %d \n Found %d EMC RecPoints and %d CPV RecPoints",
- gAlice->GetEvNumber(),
- emcRecPoints->GetEntriesFast(),
- cpvRecPoints->GetEntriesFast() )) ;
+ AliInfo(Form("\nFound %d EMC RecPoints and %d CPV RecPoints",
+ fEMCRecPoints->GetEntriesFast(),
+ fCPVRecPoints->GetEntriesFast() )) ;
- fRecPointsInRun += emcRecPoints->GetEntriesFast() ;
- fRecPointsInRun += cpvRecPoints->GetEntriesFast() ;
-
-
if(strstr(option,"all")) {
printf("\n EMC clusters \n") ;
printf("Index Ene(MeV) Multi Module X Y Z Lambdas_1 Lambda_2 # of prim Primaries list\n") ;
Int_t index ;
- for (index = 0 ; index < emcRecPoints->GetEntries() ; index++) {
- AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )emcRecPoints->At(index) ;
+ for (index = 0 ; index < fEMCRecPoints->GetEntries() ; index++) {
+ AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )fEMCRecPoints->At(index) ;
TVector3 locpos;
rp->GetLocalPosition(locpos);
Float_t lambda[2];
//Now plot CPV recPoints
printf("\n CPV clusters \n") ;
printf("Index Ene(MeV) Module X Y Z \n") ;
- for (index = 0 ; index < cpvRecPoints->GetEntries() ; index++) {
- AliPHOSCpvRecPoint * rp = (AliPHOSCpvRecPoint * )cpvRecPoints->At(index) ;
+ for (index = 0 ; index < fCPVRecPoints->GetEntries() ; index++) {
+ AliPHOSCpvRecPoint * rp = (AliPHOSCpvRecPoint * )fCPVRecPoints->At(index) ;
TVector3 locpos;
rp->GetLocalPosition(locpos);
if(!fCalibData->GetNumOfEmcBadChannels()) return;
AliInfo(Form("%d bad channel(s) found.\n",fCalibData->GetNumOfEmcBadChannels()));
- AliPHOSGetter* gime = AliPHOSGetter::Instance();
- AliPHOSGeometry* geom = gime->PHOSGeometry();
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
-
Int_t badIds[8000];
fCalibData->EmcBadChannelIds(badIds);
Float_t dist,minDist;
- for(Int_t iRP=0; iRP<emcRecPoints->GetEntries(); iRP++){
- rp = (AliPHOSEmcRecPoint*)emcRecPoints->At(iRP);
+ for(Int_t iRP=0; iRP<fEMCRecPoints->GetEntries(); iRP++){
+ rp = (AliPHOSEmcRecPoint*)fEMCRecPoints->At(iRP);
minDist = 1.e+07;
for(Int_t iBad=0; iBad<fCalibData->GetNumOfEmcBadChannels(); iBad++) {
rp->GetGlobalPosition(gposRecPoint,gmat);
- geom->RelPosInAlice(badIds[iBad],gposBadChannel);
+ fGeom->RelPosInAlice(badIds[iBad],gposBadChannel);
AliDebug(2,Form("BC position:[%.3f,%.3f,%.3f], RP position:[%.3f,%.3f,%.3f]. E=%.3f\n",
gposBadChannel.X(),gposBadChannel.Y(),gposBadChannel.Z(),
gposRecPoint.X(),gposRecPoint.Y(),gposRecPoint.Z(),rp->GetEnergy()));
/* History of cvs commits:
*
* $Log$
+ * Revision 1.52 2007/08/07 14:16:00 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.51 2007/04/11 11:55:45 policheh
* SetDistancesToBadChannels() added.
*
public:
AliPHOSClusterizerv1() ;
- AliPHOSClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
- AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) ;
+ AliPHOSClusterizerv1(AliPHOSGeometry *geom);
virtual ~AliPHOSClusterizerv1() ;
virtual Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ;
virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold; }
virtual Float_t GetCpvLocalMaxCut()const { return fCpvLocMaxCut;}
virtual Float_t GetCpvLogWeight()const { return fW0CPV;}
- virtual const char * GetRecPointsBranch() const{ return GetName() ;}
- virtual Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
+ // virtual const char * GetRecPointsBranch() const{ return GetName() ;}
- virtual void Exec(Option_t *option); // Does the job
+ virtual void Digits2Clusters(Option_t *option);
void Print(const Option_t * = "")const ;
//class member function (not object member function)
static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag) ;
// Chi^2 of the fit. Should be static to be passed to MINUIT
- void Unload() ;
+ // void Unload() ;
virtual const char * Version() const { return "clu-v1"; }
virtual void SetOldRCUFormat(Bool_t rcuFormat = kFALSE)
void GetCalibrationParameters(void);
void SetDistancesToBadChannels();
- AliPHOSClusterizerv1 & operator = (const AliPHOSClusterizerv1 & obj);
-
private:
+ AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) ;
+ AliPHOSClusterizerv1 & operator = (const AliPHOSClusterizerv1 & obj);
- const TString BranchName() const ;
-
Bool_t FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy,
Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
void Init() ;
Float_t fW0 ; // logarithmic weight for the cluster center of gravity calculation
Float_t fCpvLocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster
Float_t fW0CPV ; // logarithmic weight for the CPV cluster center of gravity calculation
- Int_t fRecPointsInRun ; //! Total number of recpoints in one run
+ // Int_t fRecPointsInRun ; //! Total number of recpoints in one run
Float_t fEmcTimeGate ; // Maximum time difference between the digits in ont EMC cluster
Bool_t fIsOldRCUFormat; // assume old RCU raw data format
- Int_t fEventCounter ; //! counts the events processed
- ClassDef(AliPHOSClusterizerv1,4) // Clusterizer implementation version 1
+ ClassDef(AliPHOSClusterizerv1,5) // Clusterizer implementation version 1
};
// --- AliRoot header files ---
#include "AliLog.h"
#include "AliPHOSClusterizerv2.h"
-#include "AliPHOSGetter.h"
-#include "TFolder.h"
#include "AliPHOSEvalRecPoint.h"
#include "AliPHOSRecCpvManager.h"
#include "AliPHOSRecEmcManager.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSQualAssDataMaker.h"
+#include "AliPHOSDigit.h"
ClassImp(AliPHOSClusterizerv2)
{}
//____________________________________________________________________________
-AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name):
-AliPHOSClusterizerv1(headerFile,name)
-{}
-
-//____________________________________________________________________________
-AliPHOSClusterizerv2::AliPHOSClusterizerv2(const AliPHOSClusterizerv2 & clu):
-AliPHOSClusterizerv1(clu)
+AliPHOSClusterizerv2::AliPHOSClusterizerv2(AliPHOSGeometry *geom):
+AliPHOSClusterizerv1(geom)
{}
//____________________________________________________________________________
{
// Returns the number of found EMC and CPV rec.points
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- numb[0] = gime->EmcRecPoints()->GetEntries();
- numb[1] = gime->CpvRecPoints()->GetEntries();
+ numb[0] = fEMCRecPoints->GetEntries();
+ numb[1] = fCPVRecPoints->GetEntries();
}
//____________________________________________________________________________
-void AliPHOSClusterizerv2::Exec(Option_t* option)
+void AliPHOSClusterizerv2::Digits2Clusters(Option_t* option)
{
// Steering method
if(strstr(option,"print"))
Print() ;
+}
+// AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder();
+// TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder();
- TObjArray* wPool = new TObjArray(400);
- wPool->SetName("SmartPoints");
- wPoolF->Add(wPool);
- wPoolF->Add(this);
+// TObjArray* wPool = new TObjArray(400);
+// wPool->SetName("SmartPoints");
+// wPoolF->Add(wPool);
+// wPoolF->Add(this);
- Int_t nevents = gime->MaxEvent() ;
- Int_t ievent ;
+// Int_t nevents = gime->MaxEvent() ;
+// Int_t ievent ;
- for(ievent = 0; ievent<nevents; ievent++) {
+// for(ievent = 0; ievent<nevents; ievent++) {
- gime->Event(ievent,"D") ;
+// gime->Event(ievent,"D") ;
- AliInfo(Form("MakeClusters invoked..")) ;
- MakeClusters() ;
- AliInfo(Form("MakeClusters done.")) ;
+// AliInfo(Form("MakeClusters invoked..")) ;
+// MakeClusters() ;
+// AliInfo(Form("MakeClusters done.")) ;
- //SmartRecPoints will communicate with wPool.
+// //SmartRecPoints will communicate with wPool.
- AliPHOSEvalRecPoint* rp=0;
+// AliPHOSEvalRecPoint* rp=0;
- // CPV reconstruction
+// // CPV reconstruction
- AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
- wPoolF->Add(recCpv);
+// AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
+// wPoolF->Add(recCpv);
- Int_t iPoint; //loop variable
+// Int_t iPoint; //loop variable
- for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
- rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
- rp->MakeJob();
- }
+// for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
+// rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
+// rp->MakeJob();
+// }
- AliPHOSEvalRecPoint pt;
- pt.UpdateWorkingPool();
+// AliPHOSEvalRecPoint pt;
+// pt.UpdateWorkingPool();
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- Int_t nOldCpv = cpvRecPoints->GetEntries();
- cpvRecPoints->Delete();
- cpvRecPoints->Compress();
+// TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+// Int_t nOldCpv = cpvRecPoints->GetEntries();
+// cpvRecPoints->Delete();
+// cpvRecPoints->Compress();
- Int_t i; //loop variable
+// Int_t i; //loop variable
- for(i=0; i<wPool->GetEntries(); i++)
- cpvRecPoints->Add(wPool->At(i));
+// for(i=0; i<wPool->GetEntries(); i++)
+// cpvRecPoints->Add(wPool->At(i));
- wPool->Clear();
- wPool->Compress();
+// wPool->Clear();
+// wPool->Compress();
- wPoolF->Remove(recCpv);
- delete recCpv;
+// wPoolF->Remove(recCpv);
+// delete recCpv;
- AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ;
- AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
+// AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ;
+// AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
- // Now Emc reconstruction
+// // Now Emc reconstruction
- AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
- wPoolF->Add(recEmc);
+// AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
+// wPoolF->Add(recEmc);
- for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
- rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
- rp->MakeJob();
- }
+// for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
+// rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
+// rp->MakeJob();
+// }
- pt.UpdateWorkingPool();
+// pt.UpdateWorkingPool();
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- Int_t nOldEmc = emcRecPoints->GetEntries();
- emcRecPoints->Delete();
- emcRecPoints->Compress();
+// TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+// Int_t nOldEmc = emcRecPoints->GetEntries();
+// emcRecPoints->Delete();
+// emcRecPoints->Compress();
- for(i=0; i<wPool->GetEntries(); i++)
- emcRecPoints->Add(wPool->At(i));
+// for(i=0; i<wPool->GetEntries(); i++)
+// emcRecPoints->Add(wPool->At(i));
- wPool->Clear();
- wPool->Compress();
+// wPool->Clear();
+// wPool->Compress();
- wPoolF->Remove(recEmc);
- delete recEmc;
+// wPoolF->Remove(recEmc);
+// delete recEmc;
- TString message ;
- message = " %d OLD cpvRecPoints\n" ;
- message += " %d\n" ;
- message += " %d cpvRecPoints\n" ;
+// TString message ;
+// message = " %d OLD cpvRecPoints\n" ;
+// message += " %d\n" ;
+// message += " %d cpvRecPoints\n" ;
- message += " %d OLD emcRecPoints " ;
- message += " %d\n" ;
- message += " %d emcRecPoints\n" ;
+// message += " %d OLD emcRecPoints " ;
+// message += " %d\n" ;
+// message += " %d emcRecPoints\n" ;
- AliInfo(Form("%s", message.Data(),
- nOldCpv,
- gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
- nOldEmc,
- gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ));
+// AliInfo(Form("%s", message.Data(),
+// nOldCpv,
+// gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
+// nOldEmc,
+// gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ));
- GetQualAssDataMaker()->Init(AliQualAss::kRECPOINTS) ;
- GetQualAssDataMaker()->SetData(gime->EmcRecPoints()) ;
- GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
- GetQualAssDataMaker()->SetData(gime->CpvRecPoints()) ;
- GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
+// GetQualAssDataMaker()->Init(AliQualAss::kRECPOINTS) ;
+// GetQualAssDataMaker()->SetData(gime->EmcRecPoints()) ;
+// GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
+// GetQualAssDataMaker()->SetData(gime->CpvRecPoints()) ;
+// GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
- WriteRecPoints();
+// WriteRecPoints();
- } // loop over events
+// } // loop over events
- if(strstr(option,"tim")) {
- gBenchmark->Stop("PHOSClusterizer");
- AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
- }
-}
+// if(strstr(option,"tim")) {
+// gBenchmark->Stop("PHOSClusterizer");
+// AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
+// }
+// }
//____________________________________________________________________________
Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
// The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
// which is compared to a digit (d2) not yet in a cluster
- const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry();
-
Int_t rv = 0 ;
Int_t relid1[4] ;
- geom->AbsToRelNumbering(d1->GetId(), relid1) ;
+ fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
Int_t relid2[4] ;
- geom->AbsToRelNumbering(d2->GetId(), relid2) ;
+ fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
public:
AliPHOSClusterizerv2();
- AliPHOSClusterizerv2(const char * headerFile, const char * name = "Default") ;
- AliPHOSClusterizerv2(const AliPHOSClusterizerv2 & clu) ;
+ AliPHOSClusterizerv2(AliPHOSGeometry *geom);
~AliPHOSClusterizerv2() {}
Int_t AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const ;
void GetNumberOfClustersFound(int* numb ) const;
- void Exec(Option_t* option);
- AliPHOSClusterizerv2 & operator = (const AliPHOSClusterizerv2 & /*rvalue*/) {
- // assignement operator requested by coding convention but not needed
- Fatal("operator =", "not implemented") ;
- return *this ;
- }
+ virtual void Digits2Clusters(Option_t* option);
+
+private:
+ AliPHOSClusterizerv2(const AliPHOSClusterizerv2 & clu) ;
+ AliPHOSClusterizerv2 & operator = (const AliPHOSClusterizerv2 &rvalue);
- ClassDef(AliPHOSClusterizerv2,1)
+ ClassDef(AliPHOSClusterizerv2,2)
};
#endif
{
// ctor only for internal usage (singleton)
Init() ;
+ fgGeom = this;
}
//____________________________________________________________________________
// gets TreeR from the root file (PHOS.RecPoints.root)
//if ( !IsLoaded("R") ) {
PhosLoader()->LoadRecPoints("UPDATE") ;
- PhosLoader()->LoadClusterizer("UPDATE") ;
// SetLoaded("R") ;
//}
virtual AliPHOSClusterizer * Clusterizer() ;
virtual TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; }
virtual Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; }
- virtual Int_t LoadClusterizer(Option_t* opt="") const {
- return PhosLoader()->LoadClusterizer(opt) ; }
virtual Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; }
- virtual Int_t WriteClusterizer(Option_t* opt="") const {
- return PhosLoader()->WriteClusterizer(opt) ; }
//========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
virtual TClonesArray * TrackSegments() const;
virtual Int_t ReadRaw(AliRawReader *rawReader,Bool_t isOldRCUFormat) ;
void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
- virtual void PostClusterizer(AliPHOSClusterizer * clu)
- const{PhosLoader()->PostClusterizer(clu) ; }
- virtual void PostPID(AliPHOSPID * pid)
- const{PhosLoader()->PostPID(pid) ; }
- virtual void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr)
- const{PhosLoader()->PostTrackSegmentMaker(tr) ; }
virtual void PostSDigitizer (AliPHOSSDigitizer * sdigitizer)
const {PhosLoader()->PostSDigitizer(sdigitizer);}
virtual void PostDigitizer (AliPHOSDigitizer * digitizer)
/* History of cvs commits:
*
* $Log$
+ * Revision 1.12 2006/08/25 16:00:53 kharlov
+ * Compliance with Effective C++AliPHOSHit.cxx
+ *
* Revision 1.11 2006/08/01 12:15:03 cvetan
* Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme
*
// AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
//AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
- AliPHOSClusterizer* Clusterizer () const {return dynamic_cast<AliPHOSClusterizer*>(Reconstructioner()) ;}
- Int_t PostClusterizer(TTask* clust) const {return PostReconstructioner(clust);}
- Int_t LoadClusterizer(Option_t * opt="") const {return LoadReconstructioner(opt);}
- Int_t WriteClusterizer(Option_t * opt="") const {return WriteReconstructioner(opt);}
-
AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
- Int_t PostPID(TTask* pid) const {return PostPIDTask(pid);}
Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
- Int_t PostTrackSegmentMaker(TTask* segmaker) const {return PostTracker(segmaker);}
Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
AliPHOSTrackSegmentMakerv1 * tsm = 0 ;
AliPHOSPIDv1 * pid = 0 ;
if(fReconstruct){ //We will need calibation parameters
- clu = new AliPHOSClusterizerv1("PHOS","On Flight") ;
+ clu = new AliPHOSClusterizerv1(gime->PHOSGeometry()) ;
clu->SetWriting(0) ; //Do not write to file
clu->SetEmcMinE(0.05) ; //Minimal energy of the digit
clu->SetEmcLocalMaxCut(0.05) ; //Height of local maximum over environment
clu->SetEmcClusteringThreshold(0.2) ; //Minimal energy to start cluster
// clu->SetUnfolding(kFALSE) ; //Do not unfold
- tsm = new AliPHOSTrackSegmentMakerv1("PHOS","On Flight") ;
+ tsm = new AliPHOSTrackSegmentMakerv1(gime->PHOSGeometry());
tsm->SetWriting(0) ; //Do not write to file
- pid = new AliPHOSPIDv1("PHOS","On Flight") ;
+ pid = new AliPHOSPIDv1(gime->PHOSGeometry()) ;
pid->SetWriting(0) ; //Do not write to file
}
if((rawStream->IsNELevent() || rawStream->IsWELevent()) && fScanSig){
ScanEdep(digits) ;
if(fReconstruct){
- gime->Clusterizer()->Exec("") ;
- gime->TrackSegmentMaker()->Exec("") ;
- gime->PID()->Exec("") ;
+ // PLEASE FIX IT !!!
+ // gime->Clusterizer()->Exec("") ;
+ // gime->TrackSegmentMaker()->Exec("") ;
+ // gime->PID()->Exec("") ;
ScanRecon(recParticles) ;
}
}
//____________________________________________________________________________
AliPHOSPID::AliPHOSPID():
- TTask("",""),
- fEventFolderName(""),
- fFirstEvent(0),
- fLastEvent(-1),
- fESD(0x0),
+ TObject(),
+ fGeom(NULL),
+ fESD(0x0),
+ fEMCRecPoints(NULL),
+ fCPVRecPoints(NULL),
+ fTrackSegments(NULL),
+ fRecParticles(NULL),
fQADM(0x0)
{
// ctor
//____________________________________________________________________________
-AliPHOSPID::AliPHOSPID(const TString alirunFileName, const TString eventFolderName):
- TTask("PHOS"+AliConfig::Instance()->GetPIDTaskName(), alirunFileName),
- fEventFolderName(eventFolderName),
- fFirstEvent(0),
- fLastEvent(-1),
- fESD(0x0),
+AliPHOSPID::AliPHOSPID(AliPHOSGeometry *geom):
+ TObject(),
+ fGeom(geom),
+ fESD(0x0),
+ fEMCRecPoints(NULL),
+ fCPVRecPoints(NULL),
+ fTrackSegments(NULL),
+ fRecParticles(NULL),
fQADM(0x0)
{
// ctor
+ fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ;
+ fRecParticles->SetName("RECPARTICLES");
+
fQADM = new AliPHOSQualAssDataMaker() ; //!Quality Assurance Data Maker
GetQualAssDataMaker()->Init(AliQualAss::kRECPARTICLES) ;
}
//____________________________________________________________________________
AliPHOSPID::AliPHOSPID(const AliPHOSPID & pid) :
- TTask(pid),fEventFolderName(pid.GetEventFolderName()),
- fFirstEvent(pid.GetFirstEvent()),fLastEvent(pid.GetLastEvent()),
+ TObject(pid),
+ fGeom(pid.fGeom),
fESD(pid.fESD),
+ fEMCRecPoints(pid.fEMCRecPoints),
+ fCPVRecPoints(pid.fCPVRecPoints),
+ fTrackSegments(pid.fTrackSegments),
+ fRecParticles(pid.fRecParticles),
fQADM(pid.fQADM)
{
// Copy constructor
}
+
//____________________________________________________________________________
AliPHOSPID::~AliPHOSPID()
{
// dtor
- //Remove this from the parental task before destroying
- if(AliPHOSGetter::Instance()->PhosLoader())
- AliPHOSGetter::Instance()->PhosLoader()->CleanPIDTask();
+ if (fEMCRecPoints) {
+ fEMCRecPoints->Delete();
+ delete fEMCRecPoints;
+ }
+ if (fCPVRecPoints) {
+ fCPVRecPoints->Delete();
+ delete fCPVRecPoints;
+ }
delete fQADM ;
}
+//____________________________________________________________________________
+void AliPHOSPID::SetInput(TTree *clustersTree, TClonesArray *trackSegments)
+{
+ // Read the clusters tree and creates the
+ // arrays with the EMC and CPV
+ // clusters.
+ // and set the corresponding branch addresses
+
+ fTrackSegments = trackSegments;
+
+ TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
+ if (!emcbranch) {
+ AliError("can't get the branch with the PHOS EMC clusters !");
+ return;
+ }
+ fEMCRecPoints = new TObjArray(100) ;
+ emcbranch->SetAddress(&fEMCRecPoints);
+ emcbranch->GetEntry(0);
+
+ TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
+ if (!cpvbranch) {
+ AliError("can't get the branch with the PHOS CPV clusters !");
+ return;
+ }
+ fCPVRecPoints = new TObjArray(100) ;
+ cpvbranch->SetAddress(&fCPVRecPoints);
+ cpvbranch->GetEntry(0);
+}
/* History of cvs commits:
*
* $Log$
+ * Revision 1.40 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.39 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
//*-- Author: Yves Schutz (SUBATECH)
// --- ROOT system ---
-
-#include "TTask.h"
-#include "AliConfig.h"
-
-class TFormula ;
-class TClonesArray ;
+#include "TObject.h"
+class TTree;
// --- Standard library ---
class AliPHOSTrackSegmentMaker ;
class AliPHOSQualAssDataMaker ;
-class AliPHOSPID : public TTask {
+class AliPHOSPID : public TObject {
public:
AliPHOSPID() ; // ctor
- AliPHOSPID (const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
+ AliPHOSPID (AliPHOSGeometry *geom);
AliPHOSPID(const AliPHOSPID & pid) ;
virtual ~AliPHOSPID() ; // dtor
AliPHOSPID & operator = (const AliPHOSPID & /*rvalue*/) {
Fatal("operator =", "not implemented") ; return *this ; }
- virtual Int_t GetRecParticlesInRun() const { Warning("GetRecParticlesInRun", "not defined" ) ; return 0 ;}
- virtual void Print(const Option_t * = "") const { Warning("Print", "not defined" ) ;}
+ virtual void TrackSegments2RecParticles(Option_t * option) = 0;
- void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
- void SetEventFolderName(TString name) { fEventFolderName = name ; }
+ void SetInput(TTree *clustersTree, TClonesArray *trackSegments);
+ TClonesArray* GetRecParticles() const { return fRecParticles; }
- TString GetEventFolderName() const {return fEventFolderName;}
- Int_t GetFirstEvent() const {return fFirstEvent; }
- Int_t GetLastEvent() const {return fLastEvent; }
+ virtual void Print(const Option_t * = "") const = 0;
void SetESD(AliESDEvent *esd) { fESD = esd; }
- virtual const char * Version() const { Warning("Version", "not defined" ) ; return 0 ; }
- virtual void WriteRecParticles() = 0;
+ virtual const char * Version() const = 0;
+
AliPHOSQualAssDataMaker * GetQualAssDataMaker() const { return fQADM ; }
protected:
- TString fEventFolderName ; // event folder name
- Int_t fFirstEvent; // first event to process
- Int_t fLastEvent; // last event to process
+ AliPHOSGeometry * fGeom; //! Pointer to PHOS Geometry
AliESDEvent * fESD; //! ESD object
+ TObjArray *fEMCRecPoints; //!Array with EMC clusters
+ TObjArray *fCPVRecPoints; //!Array with CPV clusters
+
+ TClonesArray *fTrackSegments; //!Array with found track segments
+ TClonesArray *fRecParticles; //!Array with reconstructed particles (PID)
+
private:
- virtual void Init() { Warning("Init", "not defined" ) ; }
+
AliPHOSQualAssDataMaker * fQADM ; //!Quality Assurance Data Maker
- ClassDef(AliPHOSPID,5) // Particle Identifier algorithm (base class)
+ ClassDef(AliPHOSPID,6) // Particle Identifier algorithm (base class)
} ;
/* History of cvs commits:
*
* $Log$
+ * Revision 1.15 2007/03/06 06:57:05 kharlov
+ * DP:calculation of distance to CPV done in TSM
+ *
* Revision 1.14 2006/09/07 18:31:08 kharlov
* Effective c++ corrections (T.Pocheptsov)
*
#include "TF2.h"
#include "TFormula.h"
#include "TCanvas.h"
+#include "TClonesArray.h"
#include "TBenchmark.h"
// --- Standard library ---
// --- AliRoot header files ---
#include "AliLog.h"
-#include "AliRun.h"
-#include "AliGenerator.h"
#include "AliPHOSPIDv0.h"
#include "AliPHOSEmcRecPoint.h"
#include "AliPHOSTrackSegment.h"
#include "AliPHOSRecParticle.h"
#include "AliPHOSGeometry.h"
-#include "AliPHOSLoader.h"
ClassImp( AliPHOSPIDv0)
//____________________________________________________________________________
AliPHOSPIDv0::AliPHOSPIDv0():
- fTrackSegmentsTitle(""),
- fRecPointsTitle(""),
- fRecParticlesTitle(""),
fIDOptions("dis time"),
- fNEvent(0),
fClusterizer(0),
fTSMaker(0),
fFormula(0),
fDispersion(0.f),
fCpvEmcDistance(0.f),
- fTimeGate(2.e-9f),
- fRecParticlesInRun(0)
+ fTimeGate(2.e-9f)
{
// default ctor
- fEventFolderName = "";
}
//____________________________________________________________________________
-AliPHOSPIDv0::AliPHOSPIDv0(const char * evFolderName,const char * name) :
- AliPHOSPID(evFolderName, name),
- fTrackSegmentsTitle(GetName()),
- fRecPointsTitle(GetName()),
- fRecParticlesTitle(GetName()),
+AliPHOSPIDv0::AliPHOSPIDv0(AliPHOSGeometry *geom) :
+ AliPHOSPID(geom),
fIDOptions("dis time"),
- fNEvent(0),
fClusterizer(0),
fTSMaker(0),
fFormula(new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)")),
fDispersion(2.f),
fCpvEmcDistance(3.f),
- fTimeGate(2.e-9f),
- fRecParticlesInRun(0)
+ fTimeGate(2.e-9f)
{
- //ctor with the indication on where to look for the track segments
- fEventFolderName = GetTitle() ;
- Init() ;
+ //ctor
}
//____________________________________________________________________________
AliPHOSPIDv0::AliPHOSPIDv0(const AliPHOSPIDv0 & rhs) :
AliPHOSPID(rhs),
- fTrackSegmentsTitle(rhs.fTrackSegmentsTitle),
- fRecPointsTitle(rhs.fRecPointsTitle),
- fRecParticlesTitle(rhs.fRecParticlesTitle),
fIDOptions(rhs.fIDOptions),
- fNEvent(rhs.fNEvent),
fClusterizer(rhs.fClusterizer),
fTSMaker(rhs.fTSMaker),
fFormula(rhs.fFormula),
fDispersion(rhs.fDispersion),
fCpvEmcDistance(rhs.fCpvEmcDistance),
- fTimeGate(rhs.fTimeGate),
- fRecParticlesInRun(rhs.fRecParticlesInRun)
+ fTimeGate(rhs.fTimeGate)
{
//Copy ctor, the same as compiler-generated, possibly wrong if
//someone implements dtor correctly.
{
//Copy-assignment, emulates compiler generated, possibly wrong.
AliPHOSPID::operator = (rhs);
- fTrackSegmentsTitle = rhs.fTrackSegmentsTitle;
- fRecPointsTitle = rhs.fRecPointsTitle;
- fRecParticlesTitle = rhs.fRecParticlesTitle;
fIDOptions = rhs.fIDOptions;
- fNEvent = rhs.fNEvent;
fClusterizer = rhs.fClusterizer;
fTSMaker = rhs.fTSMaker;
fFormula = rhs.fFormula;
fDispersion = rhs.fDispersion;
fCpvEmcDistance = rhs.fCpvEmcDistance;
fTimeGate = rhs.fTimeGate;
- fRecParticlesInRun = rhs.fRecParticlesInRun;
return *this;
}
//}
//____________________________________________________________________________
-void AliPHOSPIDv0::Exec(Option_t * option)
+void AliPHOSPIDv0::TrackSegments2RecParticles(Option_t * option)
{
//Steering method
-
- if( strcmp(GetName(), "")== 0 )
- Init() ;
-
+
if(strstr(option,"tim"))
gBenchmark->Start("PHOSPID");
return ;
}
- AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle());
- if(runget == 0x0)
- {
- AliError(Form("Can not find run getter in event folder \"%s\"",
- GetTitle()));
- return;
- }
-
- AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader"));
- if ( gime == 0 )
- {
- AliError("Could not obtain the Loader object !");
- return ;
- }
-
- if(gime->BranchExists("RecParticles") )
- return ;
+ AliInfo(Form("%d emc clusters, %d track segments",
+ fEMCRecPoints->GetEntriesFast(),
+ fTrackSegments->GetEntriesFast())) ;
-
- Int_t nevents = runget->GetNumberOfEvents() ; //(Int_t) gAlice->TreeE()->GetEntries() ;
-
- Int_t ievent ;
-
- for(ievent = 0; ievent < nevents; ievent++){
- runget->GetEvent(ievent);
- AliInfo(Form("event %d %d %d",
- ievent, gime->EmcRecPoints(),
- gime->TrackSegments())) ;
- MakeRecParticles() ;
+ MakeRecParticles() ;
- WriteRecParticles();
-
- if(strstr(option,"deb"))
- PrintRecParticles(option) ;
-
- //increment the total number of rec particles per run
- fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ;
+ if(strstr(option,"deb"))
+ PrintRecParticles(option) ;
- }
-
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSPID");
- AliInfo(Form("took %f seconds for PID %f seconds per event",
- gBenchmark->GetCpuTime("PHOSPID"),
- gBenchmark->GetCpuTime("PHOSPID")/nevents)) ;
+ AliInfo(Form("took %f seconds for PID",
+ gBenchmark->GetCpuTime("PHOSPID")));
}
-}
-//____________________________________________________________________________
-void AliPHOSPIDv0::Init()
-{
- // Make all memory allocations that are not possible in default constructor
- // Add the PID task to the list of PHOS tasks
-
- AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle());
- if(runget == 0x0)
- {
- AliError(Form("Can not find run getter in event folder \"%s\"",
- GetTitle()));
- return;
- }
-
- AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader"));
- if ( gime == 0 )
- {
- AliError("Could not obtain the Loader object !");
- return ;
- }
-
- gime->PostPID(this);
- gime->LoadRecParticles("UPDATE");
-
}
//____________________________________________________________________________
{
// Reconstructs the particles from the tracksegments
- TString taskName(GetName()) ;
- taskName.Remove(taskName.Index(Version())-1) ;
-
- AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle());
- if(runget == 0x0)
- {
- AliError(Form("Can not find run getter in event folder \"%s\"",
- GetTitle()));
- return;
- }
+ fRecParticles->Clear();
- AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader"));
- if ( gime == 0 )
- {
- AliError("Could not obtain the Loader object !");
- return ;
- }
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments() ;
- TClonesArray * recParticles = gime->RecParticles() ;
-
- recParticles->Clear();
-
- TIter next(trackSegments) ;
+ TIter next(fTrackSegments) ;
AliPHOSTrackSegment * ts ;
Int_t index = 0 ;
AliPHOSRecParticle * rp ;
while ( (ts = (AliPHOSTrackSegment *)next()) ) {
- new( (*recParticles)[index] ) AliPHOSRecParticle() ;
- rp = (AliPHOSRecParticle *)recParticles->At(index) ;
+ new( (*fRecParticles)[index] ) AliPHOSRecParticle() ;
+ rp = (AliPHOSRecParticle *)fRecParticles->At(index) ;
rp->SetTrackSegment(index) ;
rp->SetIndexInList(index) ;
AliPHOSEmcRecPoint * emc = 0 ;
if(ts->GetEmcIndex()>=0)
- emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ;
+ emc = (AliPHOSEmcRecPoint *) fEMCRecPoints->At(ts->GetEmcIndex()) ;
AliPHOSRecPoint * cpv = 0 ;
if(ts->GetCpvIndex()>=0)
- cpv = (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ;
+ cpv = (AliPHOSRecPoint *) fCPVRecPoints->At(ts->GetCpvIndex()) ;
//set momentum and energy first
Float_t e = emc->GetEnergy() ;
TString message ;
message = "=============== AliPHOSPIDv0 ================\n" ;
message += "Making PID\n" ;
- message += " Headers file: %s\n" ;
- message += " RecPoints branch title: %s\n" ;
- message += " TrackSegments Branch title: %s\n" ;
- message += " RecParticles Branch title %s\n" ;
message += "with parameters:\n" ;
message += " Maximal EMC - CPV distance (cm) %f\n" ;
AliInfo(Form( message.Data(),
- GetTitle(),
- fRecPointsTitle.Data(),
- fTrackSegmentsTitle.Data(),
- fRecParticlesTitle.Data(),
fCpvEmcDistance ));
if(fIDOptions.Contains("dis",TString::kIgnoreCase ))
delete fFormula;
fFormula = new TFormula("Lambda Cut",formula) ;
}
-//____________________________________________________________________________
-void AliPHOSPIDv0::WriteRecParticles()
-{
- // Saves the reconstructed particles too a file
-
- AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle());
- if(runget == 0x0)
- {
- AliError(Form("Can not find run getter in event folder \"%s\"",
- GetTitle()));
- return;
- }
-
- AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader"));
- if ( gime == 0 )
- {
- AliError("Could not obtain the Loader object !");
- return ;
- }
-
- TClonesArray * recParticles = gime->RecParticles() ;
- recParticles->Expand(recParticles->GetEntriesFast() ) ;
-
- TTree * treeR = gime->TreeR();
-
- if(!treeR){
- gime->MakeTree("R");
- treeR = gime->TreeR() ;
- }
-
- //First rp
- Int_t bufferSize = 32000 ;
- TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize);
- rpBranch->SetTitle(fRecParticlesTitle);
-
- //second, pid
- Int_t splitlevel = 0 ;
- AliPHOSPIDv0 * pid = this ;
- TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel);
- pidBranch->SetTitle(fRecParticlesTitle.Data());
-
- rpBranch->Fill() ;
- pidBranch->Fill() ;
-
- gime->WriteRecParticles("OVERWRITE");
- gime->WritePID("OVERWRITE");
-
-}
//____________________________________________________________________________
void AliPHOSPIDv0::PlotDispersionCuts()const
dir.SetZ( -dir.Z() ) ; // why ?
dir.SetMag(1.) ;
+ // One can not access MC information in the reconstruction!!
+ // PLEASE FIT IT, EITHER BY TAKING 0,0,0 OR ACCESSING THE
+ // VERTEX DIAMOND FROM CDB GRP FOLDER.
//account correction to the position of IP
- Float_t xo,yo,zo ; //Coordinates of the origin
- gAlice->Generator()->GetOrigin(xo,yo,zo) ;
- TVector3 origin(xo,yo,zo);
- dir = dir - origin ;
+ // Float_t xo,yo,zo ; //Coordinates of the origin
+ // gAlice->Generator()->GetOrigin(xo,yo,zo) ;
+ // TVector3 origin(xo,yo,zo);
+ // dir = dir - origin ;
return dir ;
}
{
// Print table of reconstructed particles
- AliRunLoader* runget = AliRunLoader::GetRunLoader(GetTitle());
- if(runget == 0x0)
- {
- AliError(Form("Can not find run getter in event folder \"%s\"",
- GetTitle()));
- return;
- }
-
- AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(runget->GetLoader("PHOSLoader"));
- if ( gime == 0 )
- {
- AliError("Could not obtain the Loader object !");
- return ;
- }
-
- TString taskName(GetName()) ;
- taskName.Remove(taskName.Index(Version())-1) ;
- TClonesArray * recParticles = gime->RecParticles() ;
-
TString message ;
- message = "event %d\n" ;
- message += " found %d RecParticles\n" ;
+ message = "Found %d RecParticles\n" ;
AliInfo(Form(message.Data(),
- gAlice->GetEvNumber(), recParticles->GetEntriesFast() )) ;
+ fRecParticles->GetEntriesFast() )) ;
if(strstr(option,"all")) { // printing found TS
AliInfo(" PARTICLE Index" ) ;
Int_t index ;
- for (index = 0 ; index < recParticles->GetEntries() ; index++) {
- AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ;
+ for (index = 0 ; index < fRecParticles->GetEntries() ; index++) {
+ AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) fRecParticles->At(index) ;
Text_t particle[11];
switch(rp->GetType()) {
}
}
}
-
-
-
/* History of cvs commits:
*
* $Log$
+ * Revision 1.12 2007/03/06 06:57:05 kharlov
+ * DP:calculation of distance to CPV done in TSM
+ *
* Revision 1.11 2006/09/07 18:31:08 kharlov
* Effective c++ corrections (T.Pocheptsov)
*
public:
AliPHOSPIDv0() ; // ctor
- AliPHOSPIDv0(const char* evFolderName, const char * tsBranch = "Default");
+ AliPHOSPIDv0(AliPHOSGeometry *geom);
virtual ~AliPHOSPIDv0() ; // dtor, empty, memory leak in fFormula member
//Compiler generated should be ok, because destructor is empty.
AliPHOSPIDv0(const AliPHOSPIDv0 & rhs);
AliPHOSPIDv0 & operator = (const AliPHOSPIDv0 & rhs);
- virtual void Exec(Option_t * option);
- // virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
- // virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
- virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
+ virtual void TrackSegments2RecParticles(Option_t * option);
virtual void PlotDispersionCuts()const ;
virtual void Print(const Option_t * = "")const ;
virtual void SetDispersionCut(Float_t cut){fDispersion = cut ; }
virtual void SetCpvtoEmcDistanceCut(Float_t cut ) {fCpvEmcDistance = cut ;}
virtual void SetTimeGate(Float_t gate) {fTimeGate = gate ;}
- // virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
- // virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
+
virtual const char * Version() const { return "pid-v0" ; }
private:
- virtual void Init() ;
void MakeRecParticles(void ) ;
// Float_t GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ; // Relative Distance CPV-EMC
TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv)const ;
void PrintRecParticles(Option_t * option) ;
- virtual void WriteRecParticles();
private:
- TString fTrackSegmentsTitle; // branch name with track segments
- TString fRecPointsTitle ; // branch name with rec points
- TString fRecParticlesTitle ; // branch name with rec particles
TString fIDOptions ; // PID option
- Int_t fNEvent ; // current event number
AliPHOSClusterizer * fClusterizer ; // !
AliPHOSTrackSegmentMaker * fTSMaker ; // !
Float_t fDispersion ; // dispersion cut
Float_t fCpvEmcDistance ; // Max EMC-CPV distance
Float_t fTimeGate ; // Time of the latest EmcRecPoint accepted as EM
- Int_t fRecParticlesInRun ; //! Total number of recparticles in one run
- ClassDef( AliPHOSPIDv0,1) // Particle identifier implementation version 1
+ ClassDef( AliPHOSPIDv0,2) // Particle identifier implementation version 1
};
/* History of cvs commits:
*
* $Log$
+ * Revision 1.113 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.112 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
//#include "AliLog.h"
#include "AliPHOS.h"
#include "AliPHOSPIDv1.h"
-#include "AliPHOSGetter.h"
#include "AliESDEvent.h"
#include "AliESDVertex.h"
-#include "AliHeader.h"
-#include "AliGenEventHeader.h"
+#include "AliPHOSTrackSegment.h"
+#include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSRecParticle.h"
ClassImp( AliPHOSPIDv1)
fBayesian(kFALSE),
fDefaultInit(kFALSE),
fWrite(kFALSE),
- fNEvent(0),
fFileNamePrincipalPhoton(),
fFileNamePrincipalPi0(),
fFileNameParameters(),
fX(0),
fPPhoton(0),
fPPi0(0),
- fRecParticlesInRun(0),
fParameters(0),
fVtx(0.),
fTFphoton(0),
fBayesian(kFALSE),
fDefaultInit(kFALSE),
fWrite(kFALSE),
- fNEvent(0),
fFileNamePrincipalPhoton(),
fFileNamePrincipalPi0(),
fFileNameParameters(),
fX(0),
fPPhoton(0),
fPPi0(0),
- fRecParticlesInRun(0),
fParameters(0),
fVtx(0.),
fTFphoton(0),
{
// ctor
InitParameters() ;
- Init() ;
}
//____________________________________________________________________________
-AliPHOSPIDv1::AliPHOSPIDv1(const TString alirunFileName, const TString eventFolderName) :
- AliPHOSPID(alirunFileName, eventFolderName),
+AliPHOSPIDv1::AliPHOSPIDv1(AliPHOSGeometry *geom):
+ AliPHOSPID(geom),
fBayesian(kFALSE),
fDefaultInit(kFALSE),
fWrite(kFALSE),
- fNEvent(0),
fFileNamePrincipalPhoton(),
fFileNamePrincipalPi0(),
fFileNameParameters(),
fX(0),
fPPhoton(0),
fPPi0(0),
- fRecParticlesInRun(0),
fParameters(0),
fVtx(0.),
fTFphoton(0),
//ctor with the indication on where to look for the track segments
InitParameters() ;
- Init() ;
fDefaultInit = kFALSE ;
}
delete fTFhhadronl;
delete fDFmuon;
}
-//____________________________________________________________________________
-const TString AliPHOSPIDv1::BranchName() const
-{
-
- return GetName() ;
-}
-//____________________________________________________________________________
-void AliPHOSPIDv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
- // Add the PID task to the list of PHOS tasks
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- if(!gime)
- gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data()) ;
-
- if ( !gime->PID() )
- gime->PostPID(this) ;
-}
-
//____________________________________________________________________________
void AliPHOSPIDv1::InitParameters()
{
// Initialize PID parameters
fWrite = kTRUE ;
- fRecParticlesInRun = 0 ;
- fNEvent = 0 ;
- fRecParticlesInRun = 0 ;
fBayesian = kTRUE ;
SetParameters() ; // fill the parameters matrix from parameters file
- SetEventRange(0,-1) ;
// initialisation of response function parameters
// Tof
}
//________________________________________________________________________
-void AliPHOSPIDv1::Exec(Option_t *option)
+void AliPHOSPIDv1::TrackSegments2RecParticles(Option_t *option)
{
// Steering method to perform particle reconstruction and identification
// for the event range from fFirstEvent to fLastEvent.
- // This range is optionally set by SetEventRange().
- // if fLastEvent=-1 (by default), then process events until the end.
if(strstr(option,"tim"))
gBenchmark->Start("PHOSPID");
return ;
}
+ if(fTrackSegments && //Skip events, where no track segments made
+ fTrackSegments->GetEntriesFast()) {
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- if (fLastEvent == -1)
- fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
- Int_t nEvents = fLastEvent - fFirstEvent + 1;
-
- Int_t ievent ;
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent,"TR") ;
- if(gime->TrackSegments() && //Skip events, where no track segments made
- gime->TrackSegments()->GetEntriesFast()) {
-
- GetVertex() ;
- MakeRecParticles() ;
-
- if(fBayesian)
- MakePID() ;
+ GetVertex() ;
+ MakeRecParticles() ;
+
+ if(fBayesian)
+ MakePID() ;
- WriteRecParticles();
- if(strstr(option,"deb"))
- PrintRecParticles(option) ;
- //increment the total number of rec particles per run
- fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ;
- }
+ if(strstr(option,"deb"))
+ PrintRecParticles(option) ;
}
+
if(strstr(option,"deb"))
PrintRecParticles(option);
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSPID");
- AliInfo(Form("took %f seconds for PID %f seconds per event",
- gBenchmark->GetCpuTime("PHOSPID"),
- gBenchmark->GetCpuTime("PHOSPID")/nEvents)) ;
+ AliInfo(Form("took %f seconds for PID",
+ gBenchmark->GetCpuTime("PHOSPID")));
}
- if(fWrite)
- Unload();
}
//________________________________________________________________________
const Int_t kSPECIES = AliPID::kSPECIESN ;
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- Int_t nparticles = gime->RecParticles()->GetEntriesFast() ;
+ Int_t nparticles = fRecParticles->GetEntriesFast() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments() ;
- if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) {
+ if ( !fEMCRecPoints || !fCPVRecPoints || !fTrackSegments ) {
AliFatal("RecPoints or TrackSegments not found !") ;
}
- TIter next(trackSegments) ;
+
+ TIter next(fTrackSegments) ;
AliPHOSTrackSegment * ts ;
Int_t index = 0 ;
AliPHOSEmcRecPoint * emc = 0 ;
if(ts->GetEmcIndex()>=0)
- emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ;
+ emc = (AliPHOSEmcRecPoint *) fEMCRecPoints->At(ts->GetEmcIndex()) ;
// AliPHOSCpvRecPoint * cpv = 0 ;
// if(ts->GetCpvIndex()>=0)
for(index = 0 ; index < nparticles ; index ++) {
- AliPHOSRecParticle * recpar = gime->RecParticle(index) ;
+ AliPHOSRecParticle * recpar = static_cast<AliPHOSRecParticle *>(fRecParticles->At(index));
//Conversion electron?
{
// Makes a RecParticle out of a TrackSegment
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments() ;
- if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) {
+ if ( !fEMCRecPoints || !fCPVRecPoints || !fTrackSegments ) {
AliFatal("RecPoints or TrackSegments not found !") ;
}
- TClonesArray * recParticles = gime->RecParticles() ;
- recParticles->Clear();
+ fRecParticles->Clear();
- TIter next(trackSegments) ;
+ TIter next(fTrackSegments) ;
AliPHOSTrackSegment * ts ;
Int_t index = 0 ;
AliPHOSRecParticle * rp ;
while ( (ts = (AliPHOSTrackSegment *)next()) ) {
// cout<<">>>>>>>>>>>>>>>PCA Index "<<index<<endl;
- new( (*recParticles)[index] ) AliPHOSRecParticle() ;
- rp = (AliPHOSRecParticle *)recParticles->At(index) ;
+ new( (*fRecParticles)[index] ) AliPHOSRecParticle() ;
+ rp = (AliPHOSRecParticle *)fRecParticles->At(index) ;
rp->SetTrackSegment(index) ;
rp->SetIndexInList(index) ;
AliPHOSEmcRecPoint * emc = 0 ;
if(ts->GetEmcIndex()>=0)
- emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ;
+ emc = (AliPHOSEmcRecPoint *) fEMCRecPoints->At(ts->GetEmcIndex()) ;
AliPHOSCpvRecPoint * cpv = 0 ;
if(ts->GetCpvIndex()>=0)
- cpv = (AliPHOSCpvRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ;
+ cpv = (AliPHOSCpvRecPoint *) fCPVRecPoints->At(ts->GetCpvIndex()) ;
Int_t track = 0 ;
track = ts->GetTrackIndex() ;
rp->SetLastDaughter(-1);
rp->SetPolarisation(0,0,0);
//Set the position in global coordinate system from the RecPoint
- AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- AliPHOSTrackSegment * ts = gime->TrackSegment(rp->GetPHOSTSIndex()) ;
- AliPHOSEmcRecPoint * erp = gime->EmcRecPoint(ts->GetEmcIndex()) ;
+ AliPHOSTrackSegment * ts = static_cast<AliPHOSTrackSegment *>(fTrackSegments->At(rp->GetPHOSTSIndex()));
+ AliPHOSEmcRecPoint * erp = static_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(ts->GetEmcIndex()));
TVector3 pos ;
- geom->GetGlobalPHOS(erp, pos) ;
+ fGeom->GetGlobalPHOS(erp, pos) ;
rp->SetPos(pos);
index++ ;
}
{
// Print table of reconstructed particles
- AliPHOSGetter *gime = AliPHOSGetter::Instance() ;
-
- TClonesArray * recParticles = gime->RecParticles() ;
-
TString message ;
- message = "\nevent " ;
- message += gime->EventNumber();
- message += " found " ;
- message += recParticles->GetEntriesFast();
+ message = " found " ;
+ message += fRecParticles->GetEntriesFast();
message += " RecParticles\n" ;
if(strstr(option,"all")) { // printing found TS
message += "\n PARTICLE Index \n" ;
Int_t index ;
- for (index = 0 ; index < recParticles->GetEntries() ; index++) {
- AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ;
+ for (index = 0 ; index < fRecParticles->GetEntries() ; index++) {
+ AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) fRecParticles->At(index) ;
message += "\n" ;
message += rp->Name().Data() ;
message += " " ;
(*fParameters)(p,i) = par ;
}
-//____________________________________________________________________________
-void AliPHOSPIDv1::Unload()
-{
- //Unloads RecPoints, Tracks and RecParticles
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- gime->PhosLoader()->UnloadRecPoints() ;
- gime->PhosLoader()->UnloadTracks() ;
- gime->PhosLoader()->UnloadRecParticles() ;
-}
-
-//____________________________________________________________________________
-void AliPHOSPIDv1::WriteRecParticles()
-{
- //It writes reconstructed particles and pid to file
-
- AliPHOSGetter *gime = AliPHOSGetter::Instance() ;
-
- TClonesArray * recParticles = gime->RecParticles() ;
- recParticles->Expand(recParticles->GetEntriesFast() ) ;
- if(fWrite){
- TTree * treeP = gime->TreeP();
-
- //First rp
- Int_t bufferSize = 32000 ;
- TBranch * rpBranch = treeP->Branch("PHOSRP",&recParticles,bufferSize);
- rpBranch->SetTitle(BranchName());
-
- rpBranch->Fill() ;
-
- gime->WriteRecParticles("OVERWRITE");
- gime->WritePID("OVERWRITE");
- }
-}
//____________________________________________________________________________
void AliPHOSPIDv1::GetVertex(void)
{ //extract vertex either using ESD or generator
return ;
}
}
- if(gAlice && gAlice->GetHeader() && gAlice->GetHeader()->GenEventHeader()){
- AliGenEventHeader *eh = gAlice->GetHeader()->GenEventHeader() ;
- TArrayF ftx ;
- eh->PrimaryVertex(ftx);
- fVtx.SetXYZ(ftx[0],ftx[1],ftx[2]) ;
- return ;
- }
-
+
+ // Use vertex diamond from CDB GRP folder if the one from ESD is missing
+ // PLEASE FIX IT
AliWarning("Can not read vertex from data, use fixed \n") ;
fVtx.SetXYZ(0.,0.,0.) ;
/* History of cvs commits:
*
* $Log$
+ * Revision 1.60 2007/04/01 15:40:15 kharlov
+ * Correction for actual vertex position implemented
+ *
* Revision 1.59 2007/03/06 06:57:46 kharlov
* DP:calculation of distance to CPV done in TSM
*
public:
AliPHOSPIDv1() ; // ctor
- AliPHOSPIDv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
+ AliPHOSPIDv1(AliPHOSGeometry *geom);
AliPHOSPIDv1(const AliPHOSPIDv1 & pid) ; // cpy ctor
virtual ~AliPHOSPIDv1() ; // dtor
- virtual void Exec(Option_t *option); // Does the job
+ virtual void TrackSegments2RecParticles(Option_t *option); // Does the job
//Get file name that contain the PCA
const TString GetFileNamePrincipal(TString particle) const;
//Get file name that contain PID parameters
const TString GetFileNameParameters() const {return fFileNameParameters ;}
- // Get number of rec.particles in this run
- virtual Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
-
-
// Get PID parameters as they are defined in fParameters
Float_t GetParameterCalibration (Int_t i) const;
Float_t GetParameterCpv2Emc (Int_t i, TString axis) const;
private:
- const TString BranchName() const ;
- virtual void Init() ;
virtual void InitParameters() ;
void MakeRecParticles(void ) ;
void MakePID(void) ;
Int_t GetHardPi0Bit (AliPHOSEmcRecPoint * emc) const;
TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSCpvRecPoint * cpv)const ;
void PrintRecParticles(Option_t * option) ;
- virtual void WriteRecParticles() ;
void SetParameters() ; //Fills the matrix of parameters
- void Unload();
//PID population
void SetInitPID(const Double_t * pid) ;
Bool_t fBayesian ; // Do PID bayesian
Bool_t fDefaultInit; //! kTRUE if the task was created by defaut ctor (only parameters are initialized)
Bool_t fWrite ; //! To write result to file
- Int_t fNEvent ; //! current event number
TString fFileNamePrincipalPhoton ; // File name of the photon principals
TString fFileNamePrincipalPi0 ; // File name of the pi0 principals
TString fFileNameParameters ; // File name with PID parameters
Double_t *fX ; //! Shower shape for the principal data
Double_t *fPPhoton ; //! Principal photon eigenvalues
Double_t *fPPi0 ; //! Principal pi0 eigenvalues
- Int_t fRecParticlesInRun ; //! Total number of recparticles in one run
TMatrixF *fParameters; //! Matrix of identification Parameters
TVector3 fVtx ; //! Vertex position in current event
Float_t fDispEnThreshold; //Minimum energy to use shower shape
Int_t fDispMultThreshold ; //Minimum multiplicity to use shower shape
- ClassDef( AliPHOSPIDv1,12) // Particle identifier implementation version 1
+ ClassDef( AliPHOSPIDv1,13) // Particle identifier implementation version 1
};
case kButton1Down:{
AliPHOSDigit * digit ;
-// Accessing geometry this way is equivalent to getting from gAlice
-// to have Detector in Folder one have to load gAlice anyway
-// AliPHOSLoader * gime = AliPHOSLoader::GetInstance();
-// AliPHOSGeometry * phosgeom = const_cast<AliPHOSGeometry*>(gime->PHOSGeometry());
-
AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry();
Int_t iDigit;
if( fPHOSMod == 0){
Int_t relid[4] ;
- AliPHOSGeometry * phosgeom = (AliPHOSGetter::Instance())->PHOSGeometry();
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry::GetInstance());
phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
fPHOSMod = relid[0];
Double_t dy;
Double_t crystalShift;
- AliPHOSGeometry * phosgeom = (AliPHOSGetter::Instance())->PHOSGeometry();
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
AliPHOSEMCAGeometry* geoEMCA = phosgeom->GetEMCAGeometry();
//Calculate offset to crystal surface.
// --- Standard library ---
// --- AliRoot header files ---
+#include "AliLog.h"
+#include "AliPHOSQualAssDataMaker.h"
#include "AliESDEvent.h"
#include "AliESDCaloCluster.h"
#include "AliPHOSReconstructor.h"
#include "AliPHOSClusterizerv1.h"
#include "AliPHOSTrackSegmentMakerv1.h"
#include "AliPHOSPIDv1.h"
-#include "AliPHOSGetter.h"
#include "AliPHOSTracker.h"
#include "AliRawReader.h"
#include "AliPHOSTrigger.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSRecoParamEmc.h"
#include "AliPHOSRecoParamCpv.h"
+#include "AliPHOSDigit.h"
+#include "AliPHOSTrackSegment.h"
+#include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSRecParticle.h"
+#include "AliPHOSRawDecoder.h"
+#include "AliPHOSRawDigiProducer.h"
+#include "AliPHOSPulseGenerator.h"
ClassImp(AliPHOSReconstructor)
AliPHOSRecoParam* AliPHOSReconstructor::fgkRecoParamCpv =0; // CPV rec. parameters
//____________________________________________________________________________
- AliPHOSReconstructor::AliPHOSReconstructor()
+AliPHOSReconstructor::AliPHOSReconstructor() :
+ fGeom(NULL)
{
// ctor
fgkRecoParamCpv = AliPHOSRecoParamCpv::GetCpvDefaultParameters();
}
+ fGeom = AliPHOSGeometry::GetInstance("IHEP","");
}
//____________________________________________________________________________
AliPHOSReconstructor::~AliPHOSReconstructor()
{
// dtor
-
+ delete fGeom;
}
//____________________________________________________________________________
-void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const
+void AliPHOSReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
{
- // method called by AliReconstruction;
+ // 'single-event' local reco method called by AliReconstruction;
// Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
// segment maker needs access to the AliESDEvent object to retrieve the tracks reconstructed by
// the global tracking.
-
- TString headerFile(runLoader->GetFileName()) ;
- TString branchName(runLoader->GetEventFolder()->GetName()) ;
-
- AliPHOSClusterizerv1 clu(headerFile, branchName);
- clu.SetEventRange(0, -1) ; // do all the events
+
+ AliPHOSClusterizerv1 clu(fGeom);
+ clu.SetInput(digitsTree);
+ clu.SetOutput(clustersTree);
if ( Debug() )
- clu.ExecuteTask("deb all") ;
+ clu.Digits2Clusters("deb all") ;
else
- clu.ExecuteTask("") ;
-
+ clu.Digits2Clusters("") ;
}
//____________________________________________________________________________
-void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const
+void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
+ AliESDEvent* esd) const
{
- // method called by AliReconstruction;
- // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
- // segment maker needs access to the AliESDEvent object to retrieve the tracks reconstructed by
- // the global tracking.
- // Here we reconstruct from Raw Data
-
- rawreader->Reset() ;
- TString headerFile(runLoader->GetFileName()) ;
- TString branchName(runLoader->GetEventFolder()->GetName()) ;
+ // This method produces PHOS rec-particles,
+ // then it creates AliESDtracks out of them and
+ // write tracks to the ESD
+
+ AliPHOSTrackSegmentMaker *tsm = new AliPHOSTrackSegmentMakerv1(fGeom);
+ tsm->GetQualAssDataMaker()->Init(AliQualAss::kTRACKSEGMENTS) ;
+ AliPHOSPID *pid = new AliPHOSPIDv1(fGeom);
+ pid->GetQualAssDataMaker()->Init(AliQualAss::kRECPARTICLES) ;
+
+ // do current event; the loop over events is done by AliReconstruction::Run()
+ tsm->SetESD(esd) ;
+ tsm->SetInput(clustersTree);
+ if ( Debug() )
+ tsm->Clusters2TrackSegments("deb all") ;
+ else
+ tsm->Clusters2TrackSegments("") ;
- AliPHOSClusterizerv1 clu(headerFile, branchName);
- clu.SetEventRange(0, -1) ; // do all the events
- clu.SetRawReader(rawreader);
-
- TString option = GetOption();
- if (option.Contains("OldRCUFormat"))
- clu.SetOldRCUFormat(kTRUE);
+ tsm->GetQualAssDataMaker()->SetData(tsm->GetTrackSegments()) ;
+ tsm->GetQualAssDataMaker()->Exec(AliQualAss::kTRACKSEGMENTS) ;
+ pid->SetInput(clustersTree, tsm->GetTrackSegments()) ;
+ pid->SetESD(esd) ;
if ( Debug() )
- clu.ExecuteTask("deb all") ;
+ pid->TrackSegments2RecParticles("deb all") ;
else
- clu.ExecuteTask("") ;
-
-}
+ pid->TrackSegments2RecParticles("") ;
-//____________________________________________________________________________
-void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const
-{
+ pid->GetQualAssDataMaker()->SetData(pid->GetRecParticles()) ;
+ pid->GetQualAssDataMaker()->Exec(AliQualAss::kRECPARTICLES) ;
+
+ // PLEASE FIX IT. SHOULD GO TO ALIRECONSTRUCTION !!
+ // if ( eventNumber == gime->MaxEvent()-1 ) {
+ // fTSM->GetQualAssDataMaker()->Finish(AliQualAss::kTRACKSEGMENTS) ;
+ // fPID->GetQualAssDataMaker()->Finish(AliQualAss::kRECPARTICLES) ;
+ // }
+
// This function creates AliESDtracks from AliPHOSRecParticles
// and
// writes them to the ESD
- Int_t eventNumber = runLoader->GetEventNumber() ;
-
-
- AliPHOSGetter *gime = AliPHOSGetter::Instance();
- gime->Event(eventNumber, "DRTP") ;
- TClonesArray *recParticles = gime->RecParticles();
+ TClonesArray *recParticles = pid->GetRecParticles();
Int_t nOfRecParticles = recParticles->GetEntries();
esd->SetNumberOfPHOSClusters(nOfRecParticles) ;
esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ;
- Int_t maxClu = esd->GetNumberOfPHOSClusters() ;
-
- AliDebug(2,Form("%d digits and %d rec. particles in event %d, option %s",gime->Digits()->GetEntries(),nOfRecParticles,eventNumber,GetOption()));
+ AliDebug(2,Form("%d rec. particles, option %s",nOfRecParticles,GetOption()));
//#########Calculate trigger and set trigger info###########
Float_t ampOutOfPatch2x2 = tr.Get2x2AmpOutOfPatch() ;
Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ;
- AliPHOSGeometry * geom = gime->PHOSGeometry();
-
Int_t iSM2x2 = tr.Get2x2SuperModule();
Int_t iSMnxn = tr.GetnxnSuperModule();
Int_t iCrystalPhi2x2 = tr.Get2x2CrystalPhi();
Int_t iAbsIdnxn =-1;
TVector3 pos2x2(-1,-1,-1);
TVector3 posnxn(-1,-1,-1);
- geom->RelToAbsNumbering(iRelId2x2, iAbsId2x2);
- geom->RelToAbsNumbering(iRelIdnxn, iAbsIdnxn);
- geom->RelPosInAlice(iAbsId2x2, pos2x2);
- geom->RelPosInAlice(iAbsIdnxn, posnxn);
+ fGeom->RelToAbsNumbering(iRelId2x2, iAbsId2x2);
+ fGeom->RelToAbsNumbering(iRelIdnxn, iAbsIdnxn);
+ fGeom->RelPosInAlice(iAbsId2x2, pos2x2);
+ fGeom->RelPosInAlice(iAbsIdnxn, posnxn);
TArrayF triggerPosition(6);
triggerPosition[0] = pos2x2(0) ;
if (Debug())
rp->Print();
// Get track segment and EMC rec.point associated with this rec.particle
- AliPHOSTrackSegment *ts = gime->TrackSegment(rp->GetPHOSTSIndex());
- AliPHOSEmcRecPoint *emcRP = gime->EmcRecPoint(ts->GetEmcIndex());
+ AliPHOSTrackSegment *ts = static_cast<AliPHOSTrackSegment *>(tsm->GetTrackSegments()->At(rp->GetPHOSTSIndex()));
+
+ // Get the clusters array
+ TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
+ if (!emcbranch) {
+ AliError("can't get the branch with the PHOS EMC clusters !");
+ return;
+ }
+ TObjArray *emcRecPoints = new TObjArray(100) ;
+ emcbranch->SetAddress(&emcRecPoints);
+ emcbranch->GetEntry(0);
+
+ AliPHOSEmcRecPoint *emcRP = static_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(ts->GetEmcIndex()));
AliESDCaloCluster *ec = new AliESDCaloCluster() ;
Float_t xyz[3];
Short_t *timeList = new Short_t[digitMult];
Short_t *digiList = new Short_t[digitMult];
+ // Read digits array
+ TBranch *branch = digitsTree->GetBranch("PHOS");
+ if (!branch) {
+ AliError("can't get the branch with the PHOS digits !");
+ return;
+ }
+ TClonesArray *digitsArr = new TClonesArray("AliPHOSDigit",100);
+ branch->SetAddress(&digitsArr);
+ branch->GetEntry(0);
+
// Convert Float_t* and Int_t* to Short_t* to save memory
for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
- AliPHOSDigit *digit = gime->Digit(digitsList[iDigit]);
+ AliPHOSDigit *digit = static_cast<AliPHOSDigit *>(digitsArr->At(digitsList[iDigit]));
amplList[iDigit] =
(Short_t)(TMath::Min(digit->GetEnergy()*gev500,kBigShort)); // Energy in units of GeV/500
timeList[iDigit] =
// add the track to the esd object
esd->AddCaloCluster(ec);
- delete ec;
+ delete ec;
+ delete [] primList;
+ delete [] amplList;
+ delete [] timeList;
+ delete [] digiList;
}
}
-//____________________________________________________________________________
-void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader,
- AliRawReader* rawReader, AliESDEvent* esd) const
+AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* /* runLoader */) const
{
- //This function creates AliESDtracks from AliPHOSRecParticles
- //and writes them to the ESD in the case of raw data reconstruction.
-
- Int_t eventNumber = runLoader->GetEventNumber() ;
-
- AliPHOSGetter *gime = AliPHOSGetter::Instance();
- gime->Event(eventNumber, "DRTP") ;
-
- TClonesArray *recParticles = gime->RecParticles();
- Int_t nOfRecParticles = recParticles->GetEntries();
-
- esd->SetNumberOfPHOSClusters(nOfRecParticles) ;
- esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ;
-
- AliDebug(2,Form("%d digits and %d rec. particles in event %d, option %s",gime->Digits()->GetEntries(),nOfRecParticles,eventNumber,GetOption()));
+ // creates the PHOS tracker
+ return new AliPHOSTracker();
+}
- for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
- AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
+void AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
+{
+ // Converts raw data to
+ // PHOS digits
+ // Works on a single-event basis
- if(rp) {
- Float_t xyz[3];
- for (Int_t ixyz=0; ixyz<3; ixyz++)
- xyz[ixyz] = rp->GetPos()[ixyz];
+ rawReader->Reset() ;
- AliDebug(2,Form("Global position xyz=(%f,%f,%f)",xyz[0],xyz[1],xyz[2]));
-
- AliPHOSTrackSegment *ts = gime->TrackSegment(rp->GetPHOSTSIndex());
- AliPHOSEmcRecPoint *emcRP = gime->EmcRecPoint(ts->GetEmcIndex());
- AliESDCaloCluster *ec = new AliESDCaloCluster() ;
+ AliPHOSRawDecoder dc(rawReader);
+ TString option = GetOption();
+ if (option.Contains("OldRCUFormat"))
+ dc.SetOldRCUFormat(kTRUE);
+ else
+ dc.SetOldRCUFormat(kFALSE);
- Int_t digitMult = emcRP->GetDigitsMultiplicity();
- Int_t *digitsList = emcRP->GetDigitsList();
- Short_t *amplList = new Short_t[digitMult];
- Short_t *digiList = new Short_t[digitMult];
+ dc.SubtractPedestals(kTRUE);
- // Convert Float_t* and Int_t* to UShort_t* to save memory
- for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
- AliPHOSDigit *digit = gime->Digit(digitsList[iDigit]);
- if(!digit) {
- AliFatal(Form("Digit not found at the expected position %d!",iDigit));
- }
- else {
- amplList[iDigit] = (Short_t)digit->GetEnergy();
- digiList[iDigit] = (Short_t)(digit->GetId());
- //timeList[iDigit] = (Short_t)(digit->GetTime());
- }
- }
+ TClonesArray *digits = new TClonesArray("AliPHOSDigit",1);
+ digits->SetName("DIGITS");
+ Int_t bufsize = 32000;
+ digitsTree->Branch("PHOS", &digits, bufsize);
- ec->SetPHOS(kTRUE);
- ec->SetPosition(xyz); //rec.point position in MARS
- ec->SetE(rp->Energy()); //total particle energy
- ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion
- ec->SetPid (rp->GetPID()) ; //array of particle identification
- ec->SetM02(emcRP->GetM2x()) ; //second moment M2x
- ec->SetM20(emcRP->GetM2z()) ; //second moment M2z
- ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima
+ AliPHOSRawDigiProducer pr;
+ pr.MakeDigits(digits,&dc);
- ec->SetEmcCpvDistance(-1); //not yet implemented
- ec->SetClusterChi2(-1); //not yet implemented
- ec->SetM11(-1) ; //not yet implemented
- // TArrayS arrayAmpList(digitMult,amplList);
-// TArrayS arrayTimeList(digitMult,timeList);
-// TArrayS arrayIndexList(digitMult,digiList);
-// ec->AddDigitAmplitude(arrayAmpList);
-// ec->AddDigitTime(arrayTimeList);
-// ec->AddDigitIndex(arrayIndexList);
- //Distance to the nearest bad crystal
- ec->SetDistanceToBadChannel(emcRP->GetDistanceToBadCrystal());
-
- // add the track to the esd object
- esd->AddCaloCluster(ec);
- delete ec;
-
+ //ADC counts -> GeV
+ for(Int_t i=0; i<digits->GetEntries(); i++) {
+ AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(i);
+ digit->SetEnergy(digit->GetEnergy()/AliPHOSPulseGenerator::GeV2ADC());
+ }
+
+ //!!!!for debug!!!
+ Int_t modMax=-111;
+ Int_t colMax=-111;
+ Int_t rowMax=-111;
+ Float_t eMax=-333;
+ //!!!for debug!!!
+
+ Int_t relId[4];
+ for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++) {
+ AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(iDigit);
+ if(digit->GetEnergy()>eMax) {
+ fGeom->AbsToRelNumbering(digit->GetId(),relId);
+ eMax=digit->GetEnergy();
+ modMax=relId[0];
+ rowMax=relId[2];
+ colMax=relId[3];
}
}
+ AliDebug(1,Form("Digit with max. energy: modMax %d colMax %d rowMax %d eMax %f\n\n",
+ modMax,colMax,rowMax,eMax));
+ digitsTree->Fill();
}
-
-AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* runLoader) const
-{
-// creates the PHOS tracker
- if (!runLoader) return NULL;
- return new AliPHOSTracker(runLoader);
-}
-
/* History of cvs commits:
*
* $Log$
+ * Revision 1.11 2007/07/24 17:20:35 policheh
+ * Usage of RecoParam objects instead of hardcoded parameters in reconstruction.
+ * (See $ALICE_ROOT/PHOS/macros/BeamTest2006/RawReconstruction.C).
+ *
* Revision 1.10 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
class AliESDEvent ;
class AliRawReader;
class AliPHOSRecoParam;
+class AliPHOSGeometry;
// --- Standard library ---
public:
AliPHOSReconstructor() ; //ctor
- AliPHOSReconstructor(const AliPHOSReconstructor & rec) : AliReconstructor(rec) {
+ AliPHOSReconstructor(const AliPHOSReconstructor & rec) :
+ AliReconstructor(rec),
+ fGeom(rec.fGeom)
+ {
// cpy ctor:
// requested by the Coding Convention
Fatal("cpy ctor", "not implemented") ;
static Bool_t Debug() { return fgDebug ; }
AliTracker *CreateTracker(AliRunLoader* runLoader) const;
using AliReconstructor::FillESD;
- virtual void FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const ;
- virtual void FillESD(AliRunLoader* runLoader,AliRawReader* rawReader,AliESDEvent* esd) const;
+ virtual void FillESD(TTree* digitsTree, TTree* clustersTree,
+ AliESDEvent* esd) const;
using AliReconstructor::Reconstruct;
- virtual void Reconstruct(AliRunLoader* runLoader) const ;
- virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader * rawreader) const ;
+ virtual Bool_t HasLocalReconstruction() const {return kTRUE;};
+ virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
+ // virtual void Reconstruct(AliRunLoader* runLoader) const ;
+ // virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader * rawreader) const ;
+
+ virtual Bool_t HasDigitConversion() const {return kTRUE;};
+ virtual void ConvertDigits(AliRawReader* /*rawReader*/, TTree* /*digitsTree*/) const;
AliPHOSReconstructor & operator = (const AliPHOSReconstructor & /*rvalue*/) {
// assignement operator requested by coding convention but not needed
static Bool_t fgDebug ; //! verbosity controller
static AliPHOSRecoParam* fgkRecoParamEmc; // reconstruction parameters for EMC
static AliPHOSRecoParam* fgkRecoParamCpv; // reconstruction parameters for EMC
+ AliPHOSGeometry* fGeom; // pointer to the PHOS geometry
- ClassDef(AliPHOSReconstructor,2) // Reconstruction algorithm class (Base Class)
+ ClassDef(AliPHOSReconstructor,3) // PHOS Reconstruction class
};
/* History of cvs commits:
*
* $Log$
+ * Revision 1.28 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.27 2006/08/25 16:56:30 kharlov
* Compliance with Effective C++
*
// --- ROOT system ---
+#include "TTree.h"
// --- Standard library ---
// --- AliRoot header files ---
#include "AliPHOSTrackSegmentMaker.h"
-#include "AliPHOSGetter.h"
#include "AliPHOSQualAssDataMaker.h"
ClassImp( AliPHOSTrackSegmentMaker)
//____________________________________________________________________________
AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() :
- TTask("",""),
- fEventFolderName(""),
- fFirstEvent(0),
- fLastEvent(-1),
+ TObject(),
fESD(0),
- fQADM(0x0)
+ fQADM(0x0),
+ fGeom(0),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
// ctor
}
//____________________________________________________________________________
-AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const TString alirunFileName,
- const TString eventFolderName):
- TTask("PHOS"+AliConfig::Instance()->GetTrackerTaskName(), alirunFileName),
- fEventFolderName(eventFolderName),
- fFirstEvent(0),
- fLastEvent(-1),
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(AliPHOSGeometry *geom):
+ TObject(),
fESD(0),
- fQADM(0x0)
+ fQADM(0x0),
+ fGeom(geom),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
// ctor
fQADM = new AliPHOSQualAssDataMaker() ; //!Quality Assurance Data Maker
//____________________________________________________________________________
AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & tsmaker) :
- TTask(tsmaker),
- fEventFolderName(tsmaker.GetEventFolderName()),
- fFirstEvent(tsmaker.GetFirstEvent()),
- fLastEvent(tsmaker.GetLastEvent()),
+ TObject(tsmaker),
fESD(tsmaker.GetESD()),
- fQADM(tsmaker.fQADM)
+ fQADM(tsmaker.fQADM),
+ fGeom(tsmaker.fGeom),
+ fEMCRecPoints(tsmaker.fEMCRecPoints),
+ fCPVRecPoints(tsmaker.fCPVRecPoints)
{
//Copy constructor
}
AliPHOSTrackSegmentMaker::~AliPHOSTrackSegmentMaker()
{
//Remove this from the parental task before destroying
- if(AliPHOSGetter::Instance()->PhosLoader())
- AliPHOSGetter::Instance()->PhosLoader()->CleanTracker();
+ // if(AliPHOSGetter::Instance()->PhosLoader())
+ // AliPHOSGetter::Instance()->PhosLoader()->CleanTracker();
delete fQADM ;
+ if (fEMCRecPoints) {
+ fEMCRecPoints->Delete();
+ delete fEMCRecPoints;
+ }
+ if (fCPVRecPoints) {
+ fCPVRecPoints->Delete();
+ delete fCPVRecPoints;
+ }
}
+//____________________________________________________________________________
+void AliPHOSTrackSegmentMaker::SetInput(TTree *clustersTree)
+{
+ // Read the clusters tree and creates the
+ // arrays with the EMC and CPV
+ // clusters.
+ // and set the corresponding branch addresses
+
+ TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
+ if (!emcbranch) {
+ AliError("can't get the branch with the PHOS EMC clusters !");
+ return;
+ }
+ fEMCRecPoints = new TObjArray(100) ;
+ emcbranch->SetAddress(&fEMCRecPoints);
+ emcbranch->GetEntry(0);
+
+ TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
+ if (!cpvbranch) {
+ AliError("can't get the branch with the PHOS CPV clusters !");
+ return;
+ }
+ fCPVRecPoints = new TObjArray(100) ;
+ cpvbranch->SetAddress(&fCPVRecPoints);
+ cpvbranch->GetEntry(0);
+}
/* History of cvs commits:
*
* $Log$
+ * Revision 1.42 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.41 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
//*-- Author: Dmitri Peressounko (RRC Kurchatov Institute & SUBATECH)
// --- ROOT system ---
-#include "TTask.h"
-#include "AliConfig.h"
-class TFile ;
-
-// --- Standard library ---
-//#include <iostream>
+#include <TObject.h>
+class TTree;
// --- AliRoot header files ---
-class AliPHOSClusterizer ;
class AliPHOSGeometry ;
class AliESDEvent ;
class AliPHOSQualAssDataMaker ;
-class AliPHOSTrackSegmentMaker : public TTask {
+class AliPHOSTrackSegmentMaker : public TObject {
public:
AliPHOSTrackSegmentMaker();
- AliPHOSTrackSegmentMaker(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
+ AliPHOSTrackSegmentMaker(AliPHOSGeometry *geom);
AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & tsmaker) ;
virtual ~ AliPHOSTrackSegmentMaker() ;
AliPHOSTrackSegmentMaker & operator = (const AliPHOSTrackSegmentMaker & /*rvalue*/) {
Fatal("operator =", "not implemented") ; return *this ; }
- virtual Int_t GetTrackSegmentsInRun() const {Warning("GetTrackSegmentsInRun", "Not Defined" ) ; return 0 ; }
+ virtual void Clusters2TrackSegments(Option_t *option) = 0;
+
+ void SetInput(TTree *clustersTree);
virtual void Print(const Option_t * = "")const {Warning("Print", "Not Defined" ) ; }
- void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
- void SetEventFolderName(TString name) { fEventFolderName = name ; }
void SetESD(AliESDEvent *esd) { fESD = esd; }
- TString GetEventFolderName() const {return fEventFolderName;}
- Int_t GetFirstEvent() const {return fFirstEvent; }
- Int_t GetLastEvent() const {return fLastEvent; }
AliESDEvent *GetESD() const {return fESD; }
- virtual void WriteTrackSegments() = 0;
-
AliPHOSQualAssDataMaker * GetQualAssDataMaker() const { return fQADM ; }
+ virtual TClonesArray * GetTrackSegments() const = 0;
+
protected:
- TString fEventFolderName ; // event folder name
- Int_t fFirstEvent; // first event to process
- Int_t fLastEvent; // last event to process
AliESDEvent * fESD; //! ESD object
-
AliPHOSQualAssDataMaker * fQADM ; //!Quality Assurance Data Maker
+ AliPHOSGeometry *fGeom; //! Pointer to the PHOS geometry
+ TObjArray *fEMCRecPoints; // Array with the EMC clusters
+ TObjArray *fCPVRecPoints; // Array with the CPV clusters
- ClassDef( AliPHOSTrackSegmentMaker,5) // Algorithm class to make PHOS track segments (Base Class)
+ ClassDef( AliPHOSTrackSegmentMaker,6) // Algorithm class to make PHOS track segments (Base Class)
};
#endif // ALIPHOSTRACKSEGMENTMAKER_H
/* History of cvs commits:
*
* $Log$
+ * Revision 1.91 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.90 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
#include "AliPHOSTrackSegmentMakerv1.h"
#include "AliPHOSTrackSegment.h"
#include "AliPHOSLink.h"
-#include "AliPHOSGetter.h"
#include "AliESDEvent.h"
#include "AliESDtrack.h"
#include "AliPHOSQualAssDataMaker.h"
+#include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSCpvRecPoint.h"
ClassImp( AliPHOSTrackSegmentMakerv1)
fCpvFirst(0),
fCpvLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
-
+ fTrackSegments(NULL)
{
// default ctor (to be used mainly by Streamer)
InitParameters() ;
}
//____________________________________________________________________________
-AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const TString & alirunFileName, const TString & eventFolderName) :
- AliPHOSTrackSegmentMaker(alirunFileName, eventFolderName),
+AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(AliPHOSGeometry *geom) :
+ AliPHOSTrackSegmentMaker(geom),
fDefaultInit(kFALSE),
fWrite(kFALSE),
fNTrackSegments(0),
fCpvFirst(0),
fCpvLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
+ fTrackSegments(NULL)
{
// ctor
InitParameters() ;
fCpvFirst(0),
fCpvLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
+ fTrackSegments(NULL)
{
// cpy ctor: no implementation yet
// requested by the Coding Convention
// fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters)
if (!fDefaultInit)
delete fLinkUpArray ;
-}
-
-
-//____________________________________________________________________________
-const TString AliPHOSTrackSegmentMakerv1::BranchName() const
-{
-
- return GetName() ;
+ if (fTrackSegments) {
+ fTrackSegments->Delete();
+ delete fTrackSegments;
+ }
}
//____________________________________________________________________________
// Finds first and last indexes between which
// clusters from one PHOS module are
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
-
//First EMC clusters
- Int_t totalEmc = emcRecPoints->GetEntriesFast() ;
+ Int_t totalEmc = fEMCRecPoints->GetEntriesFast() ;
for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) &&
- ((dynamic_cast<AliPHOSRecPoint *>(emcRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule );
+ ((dynamic_cast<AliPHOSRecPoint *>(fEMCRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule );
fEmcLast ++) ;
//Now CPV clusters
- Int_t totalCpv = cpvRecPoints->GetEntriesFast() ;
+ Int_t totalCpv = fCPVRecPoints->GetEntriesFast() ;
for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) &&
- ((dynamic_cast<AliPHOSRecPoint *>(cpvRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule );
+ ((dynamic_cast<AliPHOSRecPoint *>(fCPVRecPoints->At(fCpvLast)))->GetPHOSMod() == fModule );
fCpvLast ++) ;
}
emcClu->GetLocalPosition(vecEmc) ;
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
Double_t xCPV,zCPV ; //EMC-projected coordinates of CPV cluster
TVector3 cpvGlobal; // Global position of the CPV recpoint
- geom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
+ fGeom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
Double_t vtxCPV[3]={cpvGlobal.X(),cpvGlobal.Y(),cpvGlobal.Z()} ;
Int_t dummyMod ;
if (fESD == 0x0) {
//if no track information available, assume straight line from IP to emcal
- geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
+ fGeom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
dx=xCPV - vecEmc.X() ;
dz=zCPV - vecEmc.Z() ;
return ;
if (track->GetPxPyPzAt(rCPV, fESD->GetMagneticField(), pxyz)) { // track momentum ibid.
vecP.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
Int_t dummyMod ;
- geom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,zCPV,xCPV) ;
+ fGeom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,zCPV,xCPV) ;
}
}
}
else{
// If no global track was found, just take the nearest CPV point
- geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
+ fGeom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
dx=xCPV - vecEmc.X() ;
dz=zCPV - vecEmc.Z() ;
}
{
// Make all memory allocations that are not possible in default constructor
- AliPHOSGetter* gime = AliPHOSGetter::Instance();
- if(!gime)
- gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data());
-
fLinkUpArray = new TClonesArray("AliPHOSLink", 1000);
- if ( !gime->TrackSegmentMaker() ) {
- gime->PostTrackSegmentMaker(this);
- }
+ fTrackSegments = new TClonesArray("AliPHOSTrackSegment",100);
+ fTrackSegments->SetName("TRACKS");
}
//____________________________________________________________________________
fCpvLast = 0 ;
fLinkUpArray = 0 ;
fWrite = kTRUE ;
- fTrackSegmentsInRun = 0 ;
- SetEventRange(0,-1) ;
}
// which are not further apart from each other than fRcpv
// and sort them in accordance with this distance
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
-
fLinkUpArray->Clear() ;
AliPHOSCpvRecPoint * cpv ;
Int_t iEmcRP;
for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) {
- emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP)) ;
+ emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)) ;
//Bool_t toofar ;
Int_t iCpv = 0 ;
for(iCpv = fCpvFirst; iCpv < fCpvLast;iCpv++ ) {
- cpv = dynamic_cast<AliPHOSCpvRecPoint *>(cpvRecPoints->At(iCpv)) ;
+ cpv = dynamic_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(iCpv)) ;
Int_t track = -1 ;
Float_t dx,dz ;
GetDistanceInPHOSPlane(emcclu, cpv, track,dx,dz) ;
// unassigned RecParticles. We assign these RecPoints to TrackSegment and
// remove them from the list of "unassigned".
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments();
-
//Make arrays to mark clusters already chosen
Int_t * emcExist = 0;
if(fEmcLast > fEmcFirst)
if(cpvExist[linkUp->GetCpv()-fCpvFirst]){ //CPV still exist
Float_t dx,dz ;
linkUp->GetXZ(dx,dz) ;
- new ((* trackSegments)[fNTrackSegments])
- AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(linkUp->GetEmc())) ,
- dynamic_cast<AliPHOSCpvRecPoint *>(cpvRecPoints->At(linkUp->GetCpv())) ,
+ new ((* fTrackSegments)[fNTrackSegments])
+ AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(linkUp->GetEmc())) ,
+ dynamic_cast<AliPHOSCpvRecPoint *>(fCPVRecPoints->At(linkUp->GetCpv())) ,
linkUp->GetTrack(),dx,dz) ;
- (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
+ (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
fNTrackSegments++ ;
emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found
//mark CPV recpoint as already used
Int_t iEmcRP ;
for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){
if(emcExist[iEmcRP] > 0 ){
- new ((*trackSegments)[fNTrackSegments])
- AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP+fEmcFirst)),
+ new ((*fTrackSegments)[fNTrackSegments])
+ AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP+fEmcFirst)),
nullpointer) ;
- (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
+ (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
fNTrackSegments++;
}
}
}
//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::Exec(Option_t *option)
+void AliPHOSTrackSegmentMakerv1::Clusters2TrackSegments(Option_t *option)
{
- // Steering method to perform track segment construction for events
- // in the range from fFirstEvent to fLastEvent.
- // This range is optionally set by SetEventRange().
- // if fLastEvent=-1 (by default), then process events until the end.
+ // Steering method to perform track segment construction for the current event
+ // Returns an array with the found track-segments.
if(strstr(option,"tim"))
gBenchmark->Start("PHOSTSMaker");
return ;
}
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
- if (fLastEvent == -1)
- fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fFirstEvent,gime->MaxEvent());
- Int_t nEvents = fLastEvent - fFirstEvent + 1;
-
- Int_t ievent ;
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent,"DR") ;
- //Make some initializations
- fNTrackSegments = 0 ;
- fEmcFirst = 0 ;
- fEmcLast = 0 ;
- fCpvFirst = 0 ;
- fCpvLast = 0 ;
-
- gime->TrackSegments()->Clear();
+ //Make some initializations
+ fNTrackSegments = 0 ;
+ fEmcFirst = 0 ;
+ fEmcLast = 0 ;
+ fCpvFirst = 0 ;
+ fCpvLast = 0 ;
- // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent
-
- for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ) {
- FillOneModule() ;
- MakeLinks() ;
- MakePairs() ;
- }
-
-
- WriteTrackSegments() ;
+ fTrackSegments->Clear();
- if(strstr(option,"deb"))
- PrintTrackSegments(option);
+ // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent
- //increment the total number of track segments per run
- fTrackSegmentsInRun += gime->TrackSegments()->GetEntriesFast() ;
+ for(fModule = 1; fModule <= fGeom->GetNModules() ; fModule++ ) {
+ FillOneModule() ;
+ MakeLinks() ;
+ MakePairs() ;
}
-
+
+ if(strstr(option,"deb"))
+ PrintTrackSegments(option);
+
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSTSMaker");
- Info("Exec", "took %f seconds for making TS %f seconds per event",
- gBenchmark->GetCpuTime("PHOSTSMaker"),
- gBenchmark->GetCpuTime("PHOSTSMaker")/nEvents) ;
- }
- if(fWrite) //do not unload in "on flight" mode
- Unload();
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::Unload()
-{
- // Unloads the task from the folder
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- gime->PhosLoader()->UnloadRecPoints() ;
- gime->PhosLoader()->UnloadTracks() ;
+ Info("Exec", "took %f seconds for making TS",
+ gBenchmark->GetCpuTime("PHOSTSMaker"));
+ }
}
//____________________________________________________________________________
Info("Print", "AliPHOSTrackSegmentMakerv1 not initialized ") ;
}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::WriteTrackSegments()
-{
- // Writes found TrackSegments to TreeR. Creates branches
- // "PHOSTS" and "AliPHOSTrackSegmentMaker" with the same title.
- // In the former branch found TrackSegments are stored, while
- // in the latter all parameters, with which TS were made.
- // ROOT does not allow overwriting existing branches, therefore
- // first we check, if branches with the same title already exist.
- // If yes - exits without writing.
-
- AliPHOSGetter *gime = AliPHOSGetter::Instance() ;
-
- TClonesArray * trackSegments = gime->TrackSegments() ;
- trackSegments->Expand(trackSegments->GetEntriesFast()) ;
-
- if(fWrite){ //We write TreeT
- TTree * treeT = gime->TreeT();
-
- //First TS
- Int_t bufferSize = 32000 ;
- TBranch * tsBranch = treeT->Branch("PHOSTS",&trackSegments,bufferSize);
- tsBranch->Fill() ;
-
- gime->WriteTracks("OVERWRITE");
- gime->WriteTrackSegmentMaker("OVERWRITE");
- }
-}
-
-
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option)
{
// option deb - prints # of found TrackSegments
// option deb all - prints as well indexed of found RecParticles assigned to the TS
- TClonesArray * trackSegments = AliPHOSGetter::Instance()->TrackSegments() ;
-
Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ;
- printf("nevent: %d\n", AliPHOSGetter::Instance()->EventNumber()) ;
- printf(" Found %d TrackSegments\n", trackSegments->GetEntriesFast() );
+ printf(" Found %d TrackSegments\n", fTrackSegments->GetEntriesFast() );
if(strstr(option,"all")) { // printing found TS
printf("TrackSegment # EMC RP# CPV RP#\n") ;
Int_t index;
- for (index = 0 ; index <trackSegments->GetEntriesFast() ; index++) {
- AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )trackSegments->At(index) ;
+ for (index = 0 ; index <fTrackSegments->GetEntriesFast() ; index++) {
+ AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )fTrackSegments->At(index) ;
printf(" %d %d %d \n", ts->GetIndexInList(), ts->GetEmcIndex(), ts->GetCpvIndex() ) ;
}
}
/* History of cvs commits:
*
* $Log$
+ * Revision 1.51 2007/03/28 19:18:15 kharlov
+ * RecPoints recalculation in TSM removed
+ *
* Revision 1.50 2007/03/06 06:54:48 kharlov
* DP:Calculation of cluster properties dep. on vertex added
*
public:
AliPHOSTrackSegmentMakerv1() ;
- AliPHOSTrackSegmentMakerv1(const TString & alirunFileNameFile, const TString & eventFolderName = AliConfig::GetDefaultEventFolderName());
+ AliPHOSTrackSegmentMakerv1(AliPHOSGeometry *geom);
AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm);
virtual ~ AliPHOSTrackSegmentMakerv1() ; // dtor
- // virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;}
- // virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTrackSegmentsBranchTitle.Data() ;}
- virtual Int_t GetTrackSegmentsInRun()const {return fTrackSegmentsInRun ;}
-
- virtual void Exec(Option_t *option); // Does the job
+ virtual void Clusters2TrackSegments(Option_t *option); // Does the job
void FillOneModule() ; // Finds range in which RecPoints belonging current PHOS module are
void MakeLinks() const; //Evaluates distances(links) between EMC and CPV
//between EMCrp and CPVrp
virtual void SetMaxCPVTPCDistance(Float_t r){ fRtpc = r ;} //Maximal distance
//between EMCrp and extrapolation of TPC track
- // virtual void SetRecPointsBranch(const char * title) { fRecPointsBranchTitle = title ;}
- // virtual void SetTrackSegmentsBranch(const char * title){ fTrackSegmentsBranchTitle = title ; }
virtual const char * Version() const { return "tsm-v1" ; }
AliPHOSTrackSegmentMakerv1 & operator = (const AliPHOSTrackSegmentMakerv1 & ) {
Fatal("operator =", "not implemented") ;
return *this ;
}
- void Unload() ;
+
+ virtual TClonesArray * GetTrackSegments() const { return fTrackSegments; }
private:
- const TString BranchName() const ;
void GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * EmcClu , AliPHOSCpvRecPoint * Cpv,
Int_t & track, Float_t &dx, Float_t &dz ) const ; // see R0
void Init() ;
void InitParameters() ;
void PrintTrackSegments(Option_t *option) ;
- virtual void WriteTrackSegments() ;
private:
Int_t fCpvFirst; //! Cpv upper layer
Int_t fCpvLast; //!
Int_t fModule ; //! number of module being processed
- Int_t fTrackSegmentsInRun ; //! Total number of track segments in one run
- ClassDef( AliPHOSTrackSegmentMakerv1,3) // Implementation version 1 of algorithm class to make PHOS track segments
+ TClonesArray * fTrackSegments; // Array with found track-segments
+
+ ClassDef( AliPHOSTrackSegmentMakerv1,4) // Implementation version 1 of algorithm class to make PHOS track segments
};
/* History of cvs commits:
*
* $Log$
+ * Revision 1.6 2007/08/22 09:20:50 hristov
+ * Updated QA classes (Yves)
+ *
* Revision 1.5 2007/07/11 13:43:30 hristov
* New class AliESDEvent, backward compatibility with the old AliESD (Christian)
*
fEmcFirst(0),
fEmcLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
+ fTrackSegments(NULL)
{
// default ctor (to be used mainly by Streamer)
InitParameters() ;
}
//____________________________________________________________________________
-AliPHOSTrackSegmentMakerv2::AliPHOSTrackSegmentMakerv2(const TString & alirunFileName, const TString & eventFolderName) :
- AliPHOSTrackSegmentMaker(alirunFileName, eventFolderName),
+AliPHOSTrackSegmentMakerv2::AliPHOSTrackSegmentMakerv2(AliPHOSGeometry *geom) :
+ AliPHOSTrackSegmentMaker(geom),
fDefaultInit(kFALSE),
fWrite(kFALSE),
fNTrackSegments(0),
fEmcFirst(0),
fEmcLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
+ fTrackSegments(NULL)
{
// ctor
InitParameters() ;
fEmcFirst(0),
fEmcLast(0),
fModule(0),
- fTrackSegmentsInRun(0)
+ fTrackSegments(NULL)
{
// cpy ctor: no implementation yet
// requested by the Coding Convention
// fDefaultInit = kTRUE if TrackSegmentMaker created by default ctor (to get just the parameters)
if (!fDefaultInit)
delete fLinkUpArray ;
-}
-
-//____________________________________________________________________________
-const TString AliPHOSTrackSegmentMakerv2::BranchName() const
-{
-
- return GetName() ;
+ if (fTrackSegments) {
+ fTrackSegments->Delete();
+ delete fTrackSegments;
+ }
}
//____________________________________________________________________________
// Finds first and last indexes between which
// clusters from one PHOS module are
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
-
//First EMC clusters
- Int_t totalEmc = emcRecPoints->GetEntriesFast() ;
+ Int_t totalEmc = fEMCRecPoints->GetEntriesFast() ;
for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) &&
- ((dynamic_cast<AliPHOSRecPoint *>(emcRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule );
+ ((dynamic_cast<AliPHOSRecPoint *>(fEMCRecPoints->At(fEmcLast)))->GetPHOSMod() == fModule );
fEmcLast ++) ;
//Now TPC tracks
if(fModule==1){
Int_t nTracks = fESD->GetNumberOfTracks();
- Int_t nPHOSmod = geom->GetNModules() ;
+ Int_t nPHOSmod = fGeom->GetNModules() ;
if(fTPCtracks[0].size()<(UInt_t)nTracks){
for(Int_t i=0; i<nPHOSmod; i++)
fTPCtracks[i].resize(nTracks) ;
Double_t vtx[3]={0.,0.,0.} ;
AliESDtrack *track;
Double_t xyz[3] ;
- Double_t rEMC = geom->GetIPtoCrystalSurface() ; //Use here ideal geometry
+ Double_t rEMC = fGeom->GetIPtoCrystalSurface() ; //Use here ideal geometry
for (Int_t iTrack=0; iTrack<nTracks; iTrack++) {
track = fESD->GetTrack(iTrack);
for(Int_t iTestMod=1; iTestMod<=nPHOSmod; iTestMod++){
- Double_t modAngle=270.+geom->GetPHOSAngle(iTestMod) ;
+ Double_t modAngle=270.+fGeom->GetPHOSAngle(iTestMod) ;
modAngle*=TMath::Pi()/180. ;
track->Rotate(modAngle);
if (!track->GetXYZAt(rEMC, fESD->GetMagneticField(), xyz))
inPHOS.SetXYZ(xyz[0],xyz[1],xyz[2]);
Int_t modNum ;
Double_t x,z ;
- geom->ImpactOnEmc(vtx, inPHOS.Theta(), inPHOS.Phi(), modNum, z, x) ;
+ fGeom->ImpactOnEmc(vtx, inPHOS.Theta(), inPHOS.Phi(), modNum, z, x) ;
if(modNum==iTestMod){
//Mark this track as one belonging to module
TrackInPHOS_t &t = fTPCtracks[modNum-1][fNtpcTracks[modNum-1]++] ;
// Calculates the distance between the EMC RecPoint and the CPV RecPoint
// Clusters are sorted in "rows" and "columns" of width 1 cm
- const AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
TVector3 emcGlobal; // Global position of the EMC recpoint
- geom->GetGlobalPHOS((AliPHOSRecPoint*)emcClu,emcGlobal);
+ fGeom->GetGlobalPHOS((AliPHOSRecPoint*)emcClu,emcGlobal);
//Calculate actual distance to the PHOS surface
- Double_t modAngle=270.+geom->GetPHOSAngle(emcClu->GetPHOSMod()) ;
+ Double_t modAngle=270.+fGeom->GetPHOSAngle(emcClu->GetPHOSMod()) ;
modAngle*=TMath::Pi()/180. ;
Double_t rEMC = emcGlobal.X()*TMath::Cos(modAngle)+emcGlobal.Y()*TMath::Sin(modAngle) ;
track->Rotate(modAngle);
{
// Make all memory allocations that are not possible in default constructor
- AliPHOSGetter* gime = AliPHOSGetter::Instance();
- if(!gime)
- gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName.Data());
-
fLinkUpArray = new TClonesArray("AliPHOSLink", 1000);
- if ( !gime->TrackSegmentMaker() ) {
- gime->PostTrackSegmentMaker(this);
- }
+ fTrackSegments = new TClonesArray("AliPHOSTrackSegment",100);
}
//____________________________________________________________________________
fEmcLast = 0 ;
fLinkUpArray = 0 ;
fWrite = kTRUE ;
- fTrackSegmentsInRun = 0 ;
- SetEventRange(0,-1) ;
}
// which are not further apart from each other than fRcpv
// and sort them in accordance with this distance
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
-
fLinkUpArray->Clear() ;
AliPHOSEmcRecPoint * emcclu ;
Int_t iEmcRP;
for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) {
- emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP)) ;
+ emcclu = dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP)) ;
TVector3 vecEmc ;
emcclu->GetLocalPosition(vecEmc) ;
Int_t mod=emcclu->GetPHOSMod() ;
// unassigned RecParticles. We assign these RecPoints to TrackSegment and
// remove them from the list of "unassigned".
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- TClonesArray * trackSegments = gime->TrackSegments();
-
//Make arrays to mark clusters already chosen
Int_t * emcExist = 0;
if(fEmcLast > fEmcFirst)
if(tpcExist[linkUp->GetCpv()]){ //Track still exist
Float_t dx,dz ;
linkUp->GetXZ(dx,dz) ;
- new ((* trackSegments)[fNTrackSegments])
- AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(linkUp->GetEmc())) ,
+ new ((* fTrackSegments)[fNTrackSegments])
+ AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(linkUp->GetEmc())) ,
nullpointer,
linkUp->GetTrack(),dx,dz) ;
- (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
+ (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
fNTrackSegments++ ;
emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found
//mark track as already used
Int_t iEmcRP ;
for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){
if(emcExist[iEmcRP] > 0 ){
- new ((*trackSegments)[fNTrackSegments])
- AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(emcRecPoints->At(iEmcRP+fEmcFirst)),
+ new ((*fTrackSegments)[fNTrackSegments])
+ AliPHOSTrackSegment(dynamic_cast<AliPHOSEmcRecPoint *>(fEMCRecPoints->At(iEmcRP+fEmcFirst)),
nullpointer) ;
- (dynamic_cast<AliPHOSTrackSegment *>(trackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
+ (dynamic_cast<AliPHOSTrackSegment *>(fTrackSegments->At(fNTrackSegments)))->SetIndexInList(fNTrackSegments);
fNTrackSegments++;
}
}
}
//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv2::Exec(Option_t *option)
+void AliPHOSTrackSegmentMakerv2::Clusters2TrackSegments(Option_t *option)
{
// Steering method to perform track segment construction for events
// in the range from fFirstEvent to fLastEvent.
return ;
}
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
-
- if (fLastEvent == -1)
- fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fFirstEvent,gime->MaxEvent());
- Int_t nEvents = fLastEvent - fFirstEvent + 1;
-
- Int_t ievent ;
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- gime->Event(ievent,"DR") ;
- //Make some initializations
- fNTrackSegments = 0 ;
- fEmcFirst = 0 ;
- fEmcLast = 0 ;
+ //Make some initializations
+ fNTrackSegments = 0 ;
+ fEmcFirst = 0 ;
+ fEmcLast = 0 ;
- gime->TrackSegments()->Clear();
+ fTrackSegments->Clear();
- // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent
+ // if(!ReadRecPoints(ievent)) continue; //reads RecPoints for event ievent
- for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ) {
- FillOneModule() ;
- MakeLinks() ;
- MakePairs() ;
- }
-
- WriteTrackSegments() ;
+ for(fModule = 1; fModule <= fGeom->GetNModules() ; fModule++ ) {
+ FillOneModule() ;
+ MakeLinks() ;
+ MakePairs() ;
+ }
- if(strstr(option,"deb"))
- PrintTrackSegments(option);
+ if(strstr(option,"deb"))
+ PrintTrackSegments(option);
- //increment the total number of track segments per run
- fTrackSegmentsInRun += gime->TrackSegments()->GetEntriesFast() ;
- }
-
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSTSMaker");
- Info("Exec", "took %f seconds for making TS %f seconds per event",
- gBenchmark->GetCpuTime("PHOSTSMaker"),
- gBenchmark->GetCpuTime("PHOSTSMaker")/nEvents) ;
- }
- if(fWrite) //do not unload in "on flight" mode
- Unload();
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv2::Unload()
-{
- // Unloads the task from the folder
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- gime->PhosLoader()->UnloadRecPoints() ;
- gime->PhosLoader()->UnloadTracks() ;
+ Info("Exec", "took %f seconds for making TS",
+ gBenchmark->GetCpuTime("PHOSTSMaker"));
+ }
}
//____________________________________________________________________________
}
else
Info("Print", "AliPHOSTrackSegmentMakerv2 not initialized ") ;
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv2::WriteTrackSegments()
-{
- // Writes found TrackSegments to TreeR. Creates branches
- // "PHOSTS" and "AliPHOSTrackSegmentMaker" with the same title.
- // In the former branch found TrackSegments are stored, while
- // in the latter all parameters, with which TS were made.
- // ROOT does not allow overwriting existing branches, therefore
- // first we check, if branches with the same title already exist.
- // If yes - exits without writing.
-
- AliPHOSGetter *gime = AliPHOSGetter::Instance() ;
-
- TClonesArray * trackSegments = gime->TrackSegments() ;
- trackSegments->Expand(trackSegments->GetEntriesFast()) ;
-
- if(fWrite){ //We write TreeT
- TTree * treeT = gime->TreeT();
-
- //First TS
- Int_t bufferSize = 32000 ;
- TBranch * tsBranch = treeT->Branch("PHOSTS",&trackSegments,bufferSize);
- tsBranch->Fill() ;
-
- gime->WriteTracks("OVERWRITE");
- gime->WriteTrackSegmentMaker("OVERWRITE");
- }
}
-
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv2::PrintTrackSegments(Option_t * option)
{
// option deb - prints # of found TrackSegments
// option deb all - prints as well indexed of found RecParticles assigned to the TS
- TClonesArray * trackSegments = AliPHOSGetter::Instance()->TrackSegments() ;
-
Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ;
- printf("nevent: %d\n", gAlice->GetEvNumber()) ;
- printf(" Found %d TrackSegments\n", trackSegments->GetEntriesFast() );
+ printf(" Found %d TrackSegments\n", fTrackSegments->GetEntriesFast() );
if(strstr(option,"all")) { // printing found TS
printf("TrackSegment # EMC RP# CPV RP#\n") ;
Int_t index;
- for (index = 0 ; index <trackSegments->GetEntriesFast() ; index++) {
- AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )trackSegments->At(index) ;
+ for (index = 0 ; index <fTrackSegments->GetEntriesFast() ; index++) {
+ AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )fTrackSegments->At(index) ;
printf(" %d %d %d \n", ts->GetIndexInList(), ts->GetEmcIndex(), ts->GetTrackIndex() ) ;
}
}
/* History of cvs commits:
*
* $Log$
+ * Revision 1.3 2007/04/25 19:39:42 kharlov
+ * Track extracpolation improved
+ *
* Revision 1.2 2007/04/01 19:16:52 kharlov
* D.P.: Produce EMCTrackSegments using TPC/ITS tracks (no CPV)
*
public:
AliPHOSTrackSegmentMakerv2() ;
- AliPHOSTrackSegmentMakerv2(const TString & alirunFileNameFile, const TString & eventFolderName = AliConfig::GetDefaultEventFolderName());
+ AliPHOSTrackSegmentMakerv2(AliPHOSGeometry *geom);
AliPHOSTrackSegmentMakerv2(const AliPHOSTrackSegmentMakerv2 & tsm);
virtual ~ AliPHOSTrackSegmentMakerv2() ; // dtor
- // virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;}
- // virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTrackSegmentsBranchTitle.Data() ;}
- virtual Int_t GetTrackSegmentsInRun()const {return fTrackSegmentsInRun ;}
-
- virtual void Exec(Option_t *option); // Does the job
+ virtual void Clusters2TrackSegments(Option_t *option); // Does the job
void FillOneModule() ; // Finds range in which RecPoints belonging current PHOS module are
void MakeLinks() ; //Evaluates distances(links) between EMC and CPV
void SetWriting(Bool_t toWrite = kFALSE){fWrite = toWrite;}
virtual void SetMaxTPCDistance(Float_t r){ fRtpc = r ;} //Maximal distance
//between EMCrp and extrapolation of TPC track
- // virtual void SetRecPointsBranch(const char * title) { fRecPointsBranchTitle = title ;}
- // virtual void SetTrackSegmentsBranch(const char * title){ fTrackSegmentsBranchTitle = title ; }
- virtual const char * Version() const { return "tsm-v2" ; }
+ virtual const char * Version() const { return "tsm-v2" ; }
AliPHOSTrackSegmentMakerv2 & operator = (const AliPHOSTrackSegmentMakerv2 & ) {
// assignement operator requested by coding convention but not needed
Fatal("operator =", "not implemented") ;
return *this ;
}
- void Unload() ;
+
+ virtual TClonesArray * GetTrackSegments() const { return fTrackSegments; }
private:
- const TString BranchName() const ;
void GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * EmcClu , AliESDtrack* track,
Float_t &dx, Float_t &dz ) const ; // see R0
void Init() ;
void InitParameters() ;
void PrintTrackSegments(Option_t *option) ;
- virtual void WriteTrackSegments() ;
protected:
struct TrackInPHOS_t {
Int_t fEmcFirst; //! Index of first EMC RecPoint belonging to currect PHOS module
Int_t fEmcLast ; //!
Int_t fModule ; //! number of module being processed
- Int_t fTrackSegmentsInRun ; //! Total number of track segments in one run
- ClassDef( AliPHOSTrackSegmentMakerv2,1) // Implementation version 1 of algorithm class to make PHOS track segments
+ TClonesArray * fTrackSegments; // Array with found track-segments
+
+ ClassDef( AliPHOSTrackSegmentMakerv2,2) // Implementation version 1 of algorithm class to make PHOS track segments
};
/* History of cvs commits:
*
* $Log$
+ * Revision 1.7 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.6 2007/08/03 14:41:37 cvetan
* Missing header files
*
//____________________________________________________________________________
AliPHOSTracker::AliPHOSTracker():
- AliTracker(),
- fRunLoader(0),
- fTSM(0x0),
- fPID(0x0)
+ AliTracker()
{
//--------------------------------------------------------------------
// The default constructor
//--------------------------------------------------------------------
for (Int_t i=0; i<5; i++)
fModules[i]=new TClonesArray("AliPHOSEmcRecPoint",777);
-
- fTSM = new AliPHOSTrackSegmentMakerv1("to be set", "to be set");
- fTSM->GetQualAssDataMaker()->Init(AliQualAss::kTRACKSEGMENTS) ;
- fPID = new AliPHOSPIDv1("to be set", "to be set");
- fPID->GetQualAssDataMaker()->Init(AliQualAss::kRECPARTICLES) ;
}
//____________________________________________________________________________
(fModules[i])->Delete();
delete fModules[i];
}
- delete fTSM ;
- delete fPID ;
}
//____________________________________________________________________________
// Makes the PID
//--------------------------------------------------------------------
- // The following old function is a bad function: it uses RunLoader ;(
- PropagateBackOld(esd);
-
-
Int_t nt=esd->GetNumberOfTracks();
// *** Select and sort the ESD track in accordance with their quality
//--------------------------------------------------------------------
for (Int_t i=0; i<5; i++) (fModules[i])->Delete();
}
-
-
-
-// **** The following are bad functions: they use RunLoader ;(
-// **** To be rewritten.
-
-#include "AliPHOSTrackSegmentMakerv1.h"
-#include "AliPHOSTrackSegmentMakerv2.h"
-#include "AliPHOSPIDv1.h"
-#include "AliRunLoader.h"
-
-//____________________________________________________________________________
-Int_t AliPHOSTracker::PropagateBackOld(AliESDEvent *esd) {
- // Bad function: it uses RunLoader ;(
- // Creates the tracksegments and Recparticles
- // Makes the PID
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- Int_t eventNumber = gime->PhosLoader()->GetRunLoader()->GetEventNumber() ;
-
- TString headerFile(gime->PhosLoader()->GetRunLoader()->GetFileName()) ;
- TString branchName(gime->PhosLoader()->GetRunLoader()->GetEventFolder()->GetName()) ;
-
- // do current event; the loop over events is done by AliReconstruction::Run()
-
- fTSM->SetTitle(headerFile) ;
- fTSM->SetEventFolderName(branchName) ;
- fTSM->SetESD(esd) ;
- fTSM->SetEventRange(eventNumber, eventNumber) ;
- if ( Debug() )
- fTSM->ExecuteTask("deb all") ;
- else
- fTSM->ExecuteTask("") ;
-
- fTSM->GetQualAssDataMaker()->SetData(gime->TrackSegments()) ;
- fTSM->GetQualAssDataMaker()->Exec(AliQualAss::kTRACKSEGMENTS) ;
-
- fPID->SetTitle(headerFile) ;
- fPID->SetEventFolderName(branchName) ;
- fPID->SetESD(esd) ;
- fPID->SetEventRange(eventNumber, eventNumber) ;
- if ( Debug() )
- fPID->ExecuteTask("deb all") ;
- else
- fPID->ExecuteTask("") ;
-
- fPID->GetQualAssDataMaker()->SetData(gime->RecParticles()) ;
- fPID->GetQualAssDataMaker()->Exec(AliQualAss::kRECPARTICLES) ;
-
- if ( eventNumber == gime->MaxEvent()-1 ) {
- fTSM->GetQualAssDataMaker()->Finish(AliQualAss::kTRACKSEGMENTS) ;
- fPID->GetQualAssDataMaker()->Finish(AliQualAss::kRECPARTICLES) ;
- }
-
- return 0;
-}
-
-//____________________________________________________________________________
-AliPHOSTracker::AliPHOSTracker(AliRunLoader *l) :
- AliTracker(),
- fRunLoader(0),
- fTSM(0x0),
- fPID(0x0)
-{
- //--------------------------------------------------------------------
- // Bad constructor: uses RunLoader ;(
- //--------------------------------------------------------------------
- for (Int_t i=0; i<5; i++)
- fModules[i]=new TClonesArray("AliPHOSEmcRecPoint",777);
- fTSM = new AliPHOSTrackSegmentMakerv1("to be set", "to be set");
- fPID = new AliPHOSPIDv1("to be set", "to be set");
-}
-
/* History of cvs commits:
*
* $Log$
+ * Revision 1.5 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
* Revision 1.4 2007/08/03 13:52:16 kharlov
* Working skeleton of matching the ESD tracks and ESD clusters (Iouri Belikov)
*
class AliCluster;
class AliESDEvent;
-class AliPHOSTrackSegmentMaker ;
-class AliPHOSPID ;
class AliPHOSTracker : public AliTracker
{
public:
AliPHOSTracker();
- AliPHOSTracker(AliRunLoader *loader); // Bad !
virtual ~AliPHOSTracker();
Int_t LoadClusters(TTree *ct);
AliPHOSTracker(const AliPHOSTracker & rhs): AliTracker(rhs){}
private:
- Int_t PropagateBackOld(AliESDEvent *ev); //Bad function: uses RunLoader ;(
-
AliPHOSTracker &operator=(const AliPHOSTracker &rhs);
- AliRunLoader *fRunLoader; //! Bad !
-
static Bool_t fgDebug ; //! Verbosity controller
TClonesArray *fModules[5];
- AliPHOSTrackSegmentMaker * fTSM ; //! the track segment maker
- AliPHOSPID * fPID ; //! the pid maker
- ClassDef(AliPHOSTracker,1)
+ ClassDef(AliPHOSTracker,2)
};
#endif