{
// Create folder and task hierarchy
fName="PHOS";
- CreatePHOSFolders();
- fGeom = 0 ;
+ CreatePHOSWhiteBoard();
+
}
//____________________________________________________________________________
AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title)
{
// Create folder and task hierarchy
- CreatePHOSFolders();
- fGeom = 0 ;
+ CreatePHOSWhiteBoard();
}
//____________________________________________________________________________
-void AliPHOS::CreatePHOSFolders()
+void AliPHOS::CreatePHOSWhiteBoard()
{
// create the ALICE TFolder
// create the ALICE TTasks
// create the ALICE main TFolder
// add the Alice QA Alarms
// this should be done of course by AliRun
+ //==================== BEG TO BE DONE BY AliRUN ===========================
+ TFolder *alice = gROOT->GetRootFolder()->AddFolder("YSAlice","Alice Folder") ;
+ gROOT->GetListOfBrowsables()->Add(alice, "YSAlice") ;
- TFolder * alice = new TFolder();
- alice->SetNameTitle("YSAlice", "Alice Folder") ;
- gROOT->GetListOfBrowsables()->Add(alice) ;
-
- TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ;
+ TFolder * aliceF = alice->AddFolder("WhiteBoard", "Alice memory Folder") ;
// make it the owner of the objects that it contains
aliceF->SetOwner() ;
// geometry folder
TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ;
// alarms folder
TFolder * alarmsF = aliceF->AddFolder("QAAlarms", "Alarms raised by QA check") ;
+ // Hits folder
+ TFolder * hitsF = aliceF->AddFolder("Hits", "Hits") ;
+ // SDigits folder
+ TFolder * sdigitsF = aliceF->AddFolder("SDigits", "Summable Digits") ;
+ // Digits folder
+ TFolder * digitsF = aliceF->AddFolder("Digits", "Digits") ;
+ // RecPoints folder
+ TFolder * rpointsF = aliceF->AddFolder("RecPoints", "RecPoints") ;
+ // TrackSegments folder
+ TFolder * tsF = aliceF->AddFolder("TrackSegments", "TrackSegments") ;
+ // RecParticles folder
+ TFolder * rparticlesF = aliceF->AddFolder("RecParticles", "RecParticles") ;
// make it the owner of the objects that it contains
alarmsF->SetOwner() ;
+ hitsF->SetOwner() ;
+ sdigitsF->SetOwner() ;
+ digitsF->SetOwner() ;
+ rpointsF->SetOwner() ;
+ tsF->SetOwner() ;
+ rparticlesF->SetOwner() ;
+
+ // Tasks folder
TFolder * aliceT = alice->AddFolder("tasks", "Alice tasks Folder") ;
// make it the owner of the objects that it contains
aliceT->SetOwner() ;
TTask * aliceQA = new TTask("QA", "Alice QA tasks") ;
aliceT->Add(aliceQA);
- TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ;
+ TTask * aliceSD = new TTask("SDigitizer", "Alice SDigitizer") ;
+ aliceT->Add(aliceSD);
+
+ TTask * aliceDi = new TTask("Digitizer", "Alice Digitizer") ;
aliceT->Add(aliceDi);
TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ;
aliceT->Add(aliceRe);
+ //==================== END TO BE DONE BY AliRUN ===========================
+
+ // =================== Creating PHOS related folders
char * tempo = new char[80] ;
// creates the PHOSQA (QAChecker knows how to add itself in the tasks list)
sprintf(tempo, "%sCheckers container",GetName() ) ;
fQATask = new AliPHOSQAChecker(GetName(), tempo);
- // creates the PHOS(S)Digitizer and adds it to alice main (S)Digitizer task
+ // creates the PHOS SDigitizer and adds it to alice main SDigitizer task
+ sprintf(tempo, "%sSDigitizers container",GetName() ) ;
+ TTask * sdT = new TTask(GetName(), tempo);
+ aliceSD->Add(sdT) ;
+
+ // creates the PHOS Digitizer and adds it to alice main Digitizer task
sprintf(tempo, "%sDigitizers container",GetName() ) ;
- fSDTask = new TTask(GetName(), tempo);
- aliceDi->Add(fSDTask) ;
+ TTask * dT = new TTask(GetName(), tempo);
+ aliceDi->Add(dT) ;
// creates the PHOS reconstructioner and adds it to alice main Reconstructioner task
- sprintf(tempo, "%sReconstructioner container",GetName() ) ;
- fReTask = new TTask(GetName(), tempo);
- aliceRe->Add(fReTask) ;
+ sprintf(tempo, "%s Reconstructioner container",GetName() ) ;
+ TTask * reT = new TTask(GetName(), tempo);
+ aliceRe->Add(reT) ;
+
+ // creates the PHOS clusterizer, tracksegment maker and PID and adds it to the PHOS Reconstructioner task
delete tempo ;
geomF->AddFolder("PHOS", "Geometry for PHOS") ;
// creates the PHOSQA alarm folder
alarmsF->AddFolder("PHOS", "QA alarms from PHOS") ;
+ // creates the PHOS Hits folder
+ hitsF->AddFolder("PHOS", "Hits for PHOS") ;
+ // creates the PHOS Summable Digits folder
+ sdigitsF->AddFolder("PHOS", "Summable Digits for PHOS") ;
+ // creates the PHOS Digits folder
+ digitsF->AddFolder("PHOS", "Digits for PHOS") ;
+ // creates the PHOS RecPoints folder
+ TFolder * prpF = rpointsF->AddFolder("PHOS", "RecPoints for PHOS") ;
+ // creates the PHOS EMC RecPoints folder
+ prpF->AddFolder("emc", "EMC RecPoints for PHOS") ;
+ // creates the PHOS CPV RecPoints folder
+ prpF->AddFolder("cpv", "CPV RecPoints for PHOS") ;
+
+ // creates the PHOS TrackSegments folder
+ tsF->AddFolder("PHOS", "Track Segments for PHOS") ;
+ // creates the PHOS RecParticles folder
+ rparticlesF->AddFolder("PHOS", "RecParticles for PHOS") ;
+
}
//____________________________________________________________________________
AliPHOS::~AliPHOS()
// remove the alice folder and alice QA task that PHOS creates instead of AliRun
// remove and delete the PHOS QA tasks
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceQA = (TTask*)alice->FindObject("tasks/QA") ;
+ TTask * aliceQA = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/QA") ;
fQATask->GetListOfTasks()->Delete() ;
aliceQA->GetListOfTasks()->Remove(fQATask) ;
delete fQATask ;
{
// gets the pointer to the AliPHOSGeometry unique instance from the folder
- AliPHOSGeometry * rv ;
+ AliPHOSGeometry * rv = 0 ;
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TString path("folders/Geometry/PHOS/") ;
+ TString path("YSAlice/WhiteBoard/Geometry/PHOS/") ;
path += GetTitle() ;
- rv = (AliPHOSGeometry*)alice->FindObject(path) ;
- if ( !rv )
- rv = fGeom ;
+ rv = (AliPHOSGeometry*)gROOT->FindObjectAny(path) ;
return rv ;
}
}
}
+//____________________________________________________________________________
+void AliPHOS::WriteQA()
+{
+
+ // Make TreeQA in the output file.
+
+ if(fTreeQA == 0)
+ fTreeQA = new TTree("TreeQA", "QA Alarms") ;
+ // Create Alarms branches
+ Int_t bufferSize = 32000 ;
+ Int_t splitlevel = 0 ;
+ TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/QAAlarms/PHOS") ;
+ TString branchName(alarmsF->GetName());
+ TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel);
+ TString branchTitle = branchName + " QA alarms" ;
+ alarmsBranch->SetTitle(branchTitle);
+ alarmsBranch->Fill() ;
+
+ // fTreeQA->Fill() ;
+}
}
virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) = 0 ;
virtual void CreateMaterials() ;
- void CreatePHOSFolders();
+ void CreatePHOSWhiteBoard();
+ virtual void FinishRun() {WriteQA();}
virtual AliPHOSGeometry * GetGeometry() const ;
virtual Int_t IsVersion(void) const = 0 ;
AliPHOSQAChecker * QAChecker() {return fQATask;}
- virtual void SetTreeAddress();
+ virtual void SetTreeAddress();
+ virtual TTree * TreeQA() const {return fTreeQA; }
virtual TString Version() {return TString(" ") ; }
-
+ virtual void AliPHOS::WriteQA() ;
AliPHOS & operator = (const AliPHOS & rvalue) {
// assignement operator requested by coding convention
// but not needed
protected:
- TFolder * fFGeom ; //! Folder that holds the Geometry definition
- AliPHOSGeometry * fGeom ; // Geometry definition
AliPHOSQAChecker * fQATask ; //! PHOS checkers container
- TTask * fSDTask ; //! PHOS (S)Digitizer container
- TTask * fReTask ; //! PHOS Reconstructioner container
+ TTree * fTreeQA ; // the QA tree that contains the alarms
ClassDef(AliPHOS,2) // Photon Spectrometer Detector (base class)
#include "AliPHOSIndexToObject.h"
#include "AliPHOSCpvRecPoint.h"
#include "AliPHOSPpsdRecPoint.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSAnalyze)
{
// ctor: analyze events from root file "name"
ffileName = fileName ;
- fCorrection = 1.05 ; //Value calculated for default parameters of reconstruction
- fObjGetter = 0 ; // should be instantiated
-
+ fCorrection = 1.05 ; //Value calculated for default parameters of reconstruction
}
//____________________________________________________________________________
TH2F * recPhot = new TH2F("recPhot","RecParticles with primary Photon",64,-71.,71.,64,-71.,71.);
TH2F * recNbar = new TH2F("recNbar","RecParticles with primary Nbar", 64,-71.,71.,64,-71.,71.);
- //========== Create IndexToObjectGetter
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data(),branchName,branchTitle) ;
- fObjGetter->GetEvent(Nevent);
+ //========== Create ObjectGetter
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ;
+ const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ;
+ gime->Event(Nevent);
//Plot Primary Particles
- TParticle * primary ;
+ const TParticle * primary ;
Int_t iPrimary ;
- for ( iPrimary = 0 ; iPrimary < fObjGetter->GimeNPrimaries() ; iPrimary++)
+ for ( iPrimary = 0 ; iPrimary < gime->NPrimaries() ; iPrimary++)
{
- primary = fObjGetter->GimePrimary(iPrimary) ;
+ primary = gime->Primary(iPrimary) ;
Int_t primaryType = primary->GetPdgCode() ;
if( (primaryType == 211)||(primaryType == -211)||(primaryType == 2212)||(primaryType == -2212) ) {
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumber==Nmod)
charg->Fill(primZ,primX,primary->Energy()) ;
}
if( primaryType == 22 ) {
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
- if(moduleNumber==Nmod)
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ if(moduleNumber==Nmod)
phot->Fill(primZ,primX,primary->Energy()) ;
}
else{
if( primaryType == -2112 ) {
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumber==Nmod)
nbar->Fill(primZ,primX,primary->Energy()) ;
}
}
Int_t iSDigit ;
- AliPHOSDigit * sdigit ;
+ const AliPHOSDigit * sdigit ;
- for(iSDigit = 0; iSDigit < fObjGetter->GimeNSDigits(); iSDigit++)
+ for(iSDigit = 0; iSDigit < gime->NSDigits(); iSDigit++)
{
- sdigit = fObjGetter->GimeSDigit(iSDigit) ;
+ sdigit = gime->SDigit(iSDigit) ;
Int_t relid[4];
- fGeom->AbsToRelNumbering(sdigit->GetId(), relid) ;
+ phosgeom->AbsToRelNumbering(sdigit->GetId(), relid) ;
Float_t x,z ;
- fGeom->RelPosInModule(relid,x,z) ;
- Float_t e = fObjGetter->GimeSDigitizer()->Calibrate(sdigit->GetAmp()) ;
+ phosgeom->RelPosInModule(relid,x,z) ;
+ Float_t e = gime->SDigitizer()->Calibrate(sdigit->GetAmp()) ;
if(relid[0]==Nmod){
if(relid[1]==0) //EMC
sdigitOccupancy->Fill(x,z,e) ;
//Plot digits
Int_t iDigit ;
- AliPHOSDigit * digit ;
- for(iDigit = 0; iDigit < fObjGetter->GimeNDigits(); iDigit++)
+ const AliPHOSDigit * digit ;
+ for(iDigit = 0; iDigit < gime->NDigits(); iDigit++)
{
- digit = fObjGetter->GimeDigit(iDigit) ;
+ digit = gime->Digit(iDigit) ;
Int_t relid[4];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
Float_t x,z ;
- fGeom->RelPosInModule(relid,x,z) ;
- Float_t e = fObjGetter->GimeSDigitizer()->Calibrate(digit->GetAmp()) ;
+ phosgeom->RelPosInModule(relid,x,z) ;
+ Float_t e = gime->SDigitizer()->Calibrate(digit->GetAmp()) ;
if(relid[0]==Nmod){
if(relid[1]==0) //EMC
digitOccupancy->Fill(x,z,e) ;
Int_t irecp ;
TVector3 pos ;
- for(irecp = 0; irecp < fObjGetter->GimeNEmcRecPoints() ; irecp ++){
- AliPHOSEmcRecPoint * emc= fObjGetter->GimeEmcRecPoint(irecp) ;
+ for(irecp = 0; irecp < gime->NEmcRecPoints() ; irecp ++){
+ const AliPHOSEmcRecPoint * emc= gime->EmcRecPoint(irecp) ;
if(emc->GetPHOSMod()==Nmod){
emc->GetLocalPosition(pos) ;
emcOccupancy->Fill(pos.X(),pos.Z(),emc->GetEnergy());
}
- for(irecp = 0; irecp < fObjGetter->GimeNCpvRecPoints() ; irecp ++){
- AliPHOSRecPoint * cpv = fObjGetter->GimeCpvRecPoint(irecp) ;
+ for(irecp = 0; irecp < gime->NCpvRecPoints() ; irecp ++){
+ const AliPHOSRecPoint * cpv = gime->CpvRecPoint(irecp) ;
if((strcmp(cpv->ClassName(),"AliPHOSPpsdRecPoint" )) == 0){ // PPSD Rec Point
AliPHOSPpsdRecPoint * ppsd = (AliPHOSPpsdRecPoint*) cpv ;
ppsd->GetLocalPosition(pos) ;
//Plot RecParticles
- AliPHOSRecParticle * recParticle ;
+ const AliPHOSRecParticle * recParticle ;
Int_t iRecParticle ;
- for(iRecParticle = 0; iRecParticle < fObjGetter->GimeNRecParticles() ;iRecParticle++ )
+ for(iRecParticle = 0; iRecParticle < gime->NRecParticles() ;iRecParticle++ )
{
- recParticle = fObjGetter->GimeRecParticle(iRecParticle) ;
+ recParticle = gime->RecParticle(iRecParticle) ;
Int_t moduleNumberRec ;
Double_t recX, recZ ;
- fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
+ phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
if(moduleNumberRec == Nmod){
Double_t minDistance = 5. ;
//extract list of primaries: it is stored at EMC RecPoints
- Int_t emcIndex = fObjGetter->GimeTrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
+ Int_t emcIndex = gime->TrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
Int_t numberofprimaries ;
- Int_t * listofprimaries = fObjGetter->GimeEmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
+ Int_t * listofprimaries = gime->EmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
Int_t index ;
- TParticle * primary ;
+ const TParticle * primary ;
Double_t distance = minDistance ;
for ( index = 0 ; index < numberofprimaries ; index++){
- primary = fObjGetter->GimePrimary(listofprimaries[index]) ;
+ primary = gime->Primary(listofprimaries[index]) ;
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumberRec == moduleNumber)
distance = TMath::Sqrt((recX-primX)*(recX-primX)+(recZ-primZ)*(recZ-primZ) ) ;
if(minDistance > distance)
if(closestPrimary >=0 ){
- Int_t primaryType = fObjGetter->GimePrimary(closestPrimary)->GetPdgCode() ;
+ Int_t primaryType = gime->Primary(closestPrimary)->GetPdgCode() ;
if(primaryType==22)
recPhot->Fill(recZ,recX,recParticle->Energy()) ;
void AliPHOSAnalyze::Ls(){
//lists branches and titles of PHOS-related branches of TreeR, TreeD, TreeS
- if(fObjGetter == 0)
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data()) ;
+ AliPHOSGetter::GetInstance(ffileName.Data()) ;
Int_t ibranch;
TObjArray * branches;
void AliPHOSAnalyze::InvariantMass(const char* branchTitle)
{
// Calculates Real and Mixed invariant mass distributions
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data(),"PHOSRP",branchTitle) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ;
Int_t nMixedEvents = 4 ; //# of events used for calculation of 'mixed' distribution
//scan over all events
Int_t event ;
- for(event = 0; event < fObjGetter->GetMaxEvent(); event++ ){
-
- fObjGetter->GetEvent(event);
+ Int_t maxevent = gAlice->TreeE()->GetEntries() ;
+ // for(event = 0; event < gime->MaxEvent(); event++ ){
+ for(event = 0; event < maxevent; event++ ){
+ gime->Event(event);
//copy EM RecParticles to the "total" list
- AliPHOSRecParticle * recParticle ;
+ const AliPHOSRecParticle * recParticle ;
Int_t iRecParticle ;
- for(iRecParticle = 0; iRecParticle < fObjGetter->GimeNRecParticles() ;iRecParticle++ )
+ for(iRecParticle = 0; iRecParticle < gime->NRecParticles() ;iRecParticle++ )
{
- recParticle = fObjGetter->GimeRecParticle(iRecParticle) ;
+ recParticle = gime->RecParticle(iRecParticle) ;
if((recParticle->GetType() == AliPHOSFastRecParticle::kGAMMA)||
(recParticle->GetType() == AliPHOSFastRecParticle::kNEUTRALEM))
new( (*allRecParticleList)[iRecPhot++] ) AliPHOSRecParticle(*recParticle) ;
nRecParticles[mevent] = iRecPhot-1 ;
//check, if it is time to calculate invariant mass?
- if((mevent == 0) && (event +1 == fObjGetter->GetMaxEvent())){
+ Int_t maxevent = gAlice->TreeE()->GetEntries() ;
+ if((mevent == 0) && (event +1 == maxevent)){
+
+ // if((mevent == 0) && (event +1 == gime->MaxEvent())){
//calculate invariant mass:
Int_t irp1,irp2 ;
hEMEnergy = new TH2F("hEMEnergy", "Energy of EM with primary photon", 100, 0., 5., 100, 0., 5.);
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data(),"PHOSRP",branchTitle) ;
- fGeom = fObjGetter->GetPHOSGeometry() ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ;
+ const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ;
Int_t ievent;
- for ( ievent=0; ievent < fObjGetter->GetMaxEvent() ; ievent++){
+ Int_t maxevent = gAlice->TreeE()->GetEntries() ;
+ // for ( ievent=0; ievent < gime->MaxEvent() ; ievent++){
+ for ( ievent=0; ievent < maxevent ; ievent++){
//read the current event
- fObjGetter->GetEvent(ievent) ;
+ gime->Event(ievent) ;
- AliPHOSRecParticle * recParticle ;
+ const AliPHOSRecParticle * recParticle ;
Int_t iRecParticle ;
- for(iRecParticle = 0; iRecParticle < fObjGetter->GimeNRecParticles() ;iRecParticle++ ){
- recParticle = fObjGetter->GimeRecParticle(iRecParticle) ;
+ for(iRecParticle = 0; iRecParticle < gime->NRecParticles() ;iRecParticle++ ){
+ recParticle = gime->RecParticle(iRecParticle) ;
//find the closest primary
Int_t moduleNumberRec ;
Double_t recX, recZ ;
- fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
+ phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
Double_t minDistance = 100. ;
Int_t closestPrimary = -1 ;
//extract list of primaries: it is stored at EMC RecPoints
- Int_t emcIndex = fObjGetter->GimeTrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
+ Int_t emcIndex = gime->TrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
Int_t numberofprimaries ;
- Int_t * listofprimaries = fObjGetter->GimeEmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
+ Int_t * listofprimaries = gime->EmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
Int_t index ;
- TParticle * primary ;
+ const TParticle * primary ;
Double_t distance = minDistance ;
Double_t dX, dZ;
Double_t dXmin = 0.;
Double_t dZmin = 0. ;
for ( index = 0 ; index < numberofprimaries ; index++){
- primary = fObjGetter->GimePrimary(listofprimaries[index]) ;
+ primary = gime->Primary(listofprimaries[index]) ;
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumberRec == moduleNumber) {
dX = recX - primX;
dZ = recZ - primZ;
//if found primary, fill histograms
if(closestPrimary >=0 ){
- TParticle * primary = fObjGetter->GimePrimary(closestPrimary) ;
+ const TParticle * primary = gime->Primary(closestPrimary) ;
if(primary->GetPdgCode() == 22){
hAllEnergy->Fill(primary->Energy(), recParticle->Energy()) ;
if(recParticle->GetType() == AliPHOSFastRecParticle::kGAMMA){
"Delta X of any RP with primary photon",100, -2., 2.);
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data(),"PHOSRP",branchTitle) ;
-
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),branchTitle) ;
+ const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ;
- fGeom = AliPHOSGeometry::GetInstance(((AliPHOS*)gAlice->GetModule("PHOS"))->GetGeometry()->GetName(),
- ((AliPHOS*)gAlice->GetModule("PHOS"))->GetGeometry()->GetTitle() );
-
Int_t ievent;
- for ( ievent=0; ievent < fObjGetter->GetMaxEvent() ; ievent++){
+ Int_t maxevent = gAlice->TreeE()->GetEntries() ;
+ // for ( ievent=0; ievent < gime->MaxEvent() ; ievent++){
+ for ( ievent=0; ievent < maxevent ; ievent++){
+
//read the current event
- fObjGetter->GetEvent(ievent) ;
+ gime->Event(ievent) ;
- AliPHOSRecParticle * recParticle ;
+ const AliPHOSRecParticle * recParticle ;
Int_t iRecParticle ;
- for(iRecParticle = 0; iRecParticle < fObjGetter->GimeNRecParticles() ;iRecParticle++ ){
- recParticle = fObjGetter->GimeRecParticle(iRecParticle) ;
+ for(iRecParticle = 0; iRecParticle < gime->NRecParticles() ;iRecParticle++ ){
+ recParticle = gime->RecParticle(iRecParticle) ;
//find the closest primary
Int_t moduleNumberRec ;
Double_t recX, recZ ;
- fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
+ phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
Double_t minDistance = 100. ;
Int_t closestPrimary = -1 ;
//extract list of primaries: it is stored at EMC RecPoints
- Int_t emcIndex = fObjGetter->GimeTrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
+ Int_t emcIndex = gime->TrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
Int_t numberofprimaries ;
- Int_t * listofprimaries = fObjGetter->GimeEmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
+ Int_t * listofprimaries = gime->EmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
Int_t index ;
- TParticle * primary ;
+ const TParticle * primary ;
Double_t distance = minDistance ;
Double_t dX = 1000; // incredible number
Double_t dZ = 1000; // for the case if no primary will be found
Double_t dXmin = 0.;
Double_t dZmin = 0. ;
for ( index = 0 ; index < numberofprimaries ; index++){
- primary = fObjGetter->GimePrimary(listofprimaries[index]) ;
+ primary = gime->Primary(listofprimaries[index]) ;
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumberRec == moduleNumber) {
dX = recX - primX;
dZ = recZ - primZ;
//if found primary, fill histograms
if(closestPrimary >=0 ){
- TParticle * primary = fObjGetter->GimePrimary(closestPrimary) ;
+ const TParticle * primary = gime->Primary(closestPrimary) ;
if(primary->GetPdgCode() == 22){
hAllPosition->Fill(primary->Energy(), minDistance) ;
hAllPositionX->Fill(primary->Energy(), dX) ;
- fObjGetter = AliPHOSIndexToObject::GetInstance(ffileName.Data(),"PHOSRP",RecPointsTitle) ;
- fGeom = AliPHOSGeometry::GetInstance(((AliPHOS*)gAlice->GetModule("PHOS"))->GetGeometry()->GetName(),
- ((AliPHOS*)gAlice->GetModule("PHOS"))->GetGeometry()->GetTitle() );
-
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(ffileName.Data(),RecPointsTitle) ;
+ const AliPHOSGeometry * phosgeom = gime->PHOSGeometry() ;
+
Int_t ievent;
- for ( ievent=0; ievent < fObjGetter->GetMaxEvent() ; ievent++){
+ Int_t maxevent = gAlice->TreeE()->GetEntries() ;
+ // for ( ievent=0; ievent < gime->MaxEvent() ; ievent++){
+ for ( ievent=0; ievent < maxevent ; ievent++){
- fObjGetter->GetEvent(ievent) ;
+ gime->Event(ievent) ;
//=========== Make spectrum of the primary photons
- TParticle * primary ;
+ const TParticle * primary ;
Int_t iPrimary ;
- for( iPrimary = 0 ; iPrimary < fObjGetter->GimeNPrimaries() ; iPrimary++){
- primary = fObjGetter->GimePrimary(iPrimary) ;
+ for( iPrimary = 0 ; iPrimary < gime->NPrimaries() ; iPrimary++){
+ primary = gime->Primary(iPrimary) ;
Int_t primaryType = primary->GetPdgCode() ;
if( primaryType == 22 ) {
//check, if photons folls onto PHOS
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumber)
hPrimary->Fill(primary->Energy()) ;
}
//========== Now scan over RecParticles
- AliPHOSRecParticle * recParticle ;
+ const AliPHOSRecParticle * recParticle ;
Int_t iRecParticle ;
- for(iRecParticle = 0; iRecParticle < fObjGetter->GimeNRecParticles(); iRecParticle++ ){
- recParticle = fObjGetter->GimeRecParticle(iRecParticle) ;
+ for(iRecParticle = 0; iRecParticle < gime->NRecParticles(); iRecParticle++ ){
+ recParticle = gime->RecParticle(iRecParticle) ;
//fill histo spectrum of all RecParticles
hAllRP->Fill(CorrectedEnergy(recParticle->Energy())) ;
//==========find the closest primary
Int_t moduleNumberRec ;
Double_t recX, recZ ;
- fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
+ phosgeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
Double_t minDistance = 100. ;
Int_t closestPrimary = -1 ;
//extract list of primaries: it is stored at EMC RecPoints
- Int_t emcIndex = fObjGetter->GimeTrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
+ Int_t emcIndex = gime->TrackSegment(recParticle->GetPHOSTSIndex())->GetEmcIndex() ;
Int_t numberofprimaries ;
- Int_t * listofprimaries = fObjGetter->GimeEmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
+ Int_t * listofprimaries = gime->EmcRecPoint(emcIndex)->GetPrimaries(numberofprimaries) ;
Int_t index ;
- TParticle * primary ;
+ const TParticle * primary ;
Double_t distance = minDistance ;
Double_t dX, dZ;
Double_t dXmin = 0.;
Double_t dZmin = 0. ;
for ( index = 0 ; index < numberofprimaries ; index++){
- primary = fObjGetter->GimePrimary(listofprimaries[index]) ;
+ primary = gime->Primary(listofprimaries[index]) ;
Int_t moduleNumber ;
Double_t primX, primZ ;
- fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
+ phosgeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
if(moduleNumberRec == moduleNumber) {
dX = recX - primX;
dZ = recZ - primZ;
//===========define the "type" of closest primary
if(closestPrimary >=0 ){
Int_t primaryCode = -1;
- TParticle * primary = fObjGetter->GimePrimary(closestPrimary) ;
+ const TParticle * primary = gime->Primary(closestPrimary) ;
Int_t primaryType = primary->GetPdgCode() ;
if(primaryType == 22) // photon ?
primaryCode = 0 ;
else
if(primaryType == -2122) //Anti proton
primaryCode = 4 ;
- else
- if(fObjGetter->GimePrimary(closestPrimary)->GetPDG()->Charge())
+ else {
+ TParticle tempo(*primary) ;
+ if(tempo.GetPDG()->Charge())
primaryCode = 3 ;
-
+ }
+
//==========Now look at the type of RecParticle
Float_t energy = CorrectedEnergy(recParticle->Energy()) ;
if(recParticle->GetType() == AliPHOSFastRecParticle::kGAMMA){
//print Final Table
+ maxevent = gAlice->TreeE()->GetEntries() ;
+ // cout << "Resolutions: Analyzed " << gime->MaxEvent() << " event(s)" << endl ;
- cout << "Resolutions: Analyzed " << fObjGetter->GetMaxEvent() << " event(s)" << endl ;
+ cout << "Resolutions: Analyzed " << maxevent << " event(s)" << endl ;
cout << endl ;
cout << " Primary: Photon Neutron Antineutron Charged hadron AntiProton" << endl ;
class AliPHOSv1 ;
class AliPHOSGeometry ;
-class AliPHOSIndexToObject ;
+class AliPHOSGetter ;
class AliPHOSAnalyze : public TObject {
Float_t fCorrection ; //! Conversion coefficient between True and Reconstructed energies
Int_t fEvt ; //! the evt number being processed
- AliPHOSGeometry * fGeom ; //! the PHOS Geometry object
- AliPHOSIndexToObject * fObjGetter ; //! provides methods to retrieve objects from their index in a list
TString ffileName ; //! the root file that contains the data
ClassImp(AliPHOSClusterizer)
//____________________________________________________________________________
- AliPHOSClusterizer::AliPHOSClusterizer():TTask("AliPHOSClusterizer","")
+ AliPHOSClusterizer::AliPHOSClusterizer():TTask("","")
{
// ctor
}
//____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const char* HeaderFile,const char* DigitsFile = 0):
-TTask("AliPHOSClusterizer","")
+AliPHOSClusterizer::AliPHOSClusterizer(const char* headerFile, const char* name):
+TTask(name, headerFile)
{
// ctor
}
public:
- AliPHOSClusterizer() ; // ctor
- AliPHOSClusterizer(const char * headerFile,const char * digitsBrancheTitle);
+ AliPHOSClusterizer() ; // default ctor
+ AliPHOSClusterizer(const char * headerFile, const char * name) ;
virtual ~AliPHOSClusterizer() ; // dtor
virtual Float_t GetEmcClusteringThreshold()const = 0 ;
virtual void SetCpvLocalMaxCut(Float_t cut) = 0 ;
virtual void SetCpvLogWeight(Float_t w) = 0 ;
virtual void SetPpsdClusteringThreshold(Float_t cluth) = 0 ;
-
virtual void SetDigitsBranch(const char * title) = 0 ;
virtual void SetRecPointsBranch(const char *title) = 0 ;
-
virtual void SetUnfolding(Bool_t toUnfold ) = 0 ;
+ virtual const char * Version() const = 0 ;
-
ClassDef(AliPHOSClusterizer,1) // Clusterization algorithm class
} ;
#include "AliPHOSEmcRecPoint.h"
#include "AliPHOS.h"
#include "AliPHOSPpsdRecPoint.h"
+#include "AliPHOSGetter.h"
#include "AliRun.h"
ClassImp(AliPHOSClusterizerv1)
//____________________________________________________________________________
- AliPHOSClusterizerv1::AliPHOSClusterizerv1():AliPHOSClusterizer()
+ AliPHOSClusterizerv1::AliPHOSClusterizerv1() : AliPHOSClusterizer()
{
// default ctor (to be used mainly by Streamer)
- SetName("AliPHOSClusterizer");
- SetTitle("Version 1") ;
fNumberOfCpvClusters = 0 ;
fNumberOfEmcClusters = 0 ;
fW0 = 4.5 ;
fW0CPV = 4.0 ;
-
- fGeom = 0 ;
-
- fDigits = 0 ;
- fDigitizer = 0 ;
- fEmcRecPoints = 0 ;
- fCpvRecPoints = 0 ;
- fIsInitialized = kFALSE ;
+ fHeaderFileName = "" ;
+ fDigitsBranchTitle = "" ;
}
+
//____________________________________________________________________________
-AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* digitsFile):AliPHOSClusterizer()
+AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* name)
+:AliPHOSClusterizer(headerFile, name)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
-
- SetName("AliPHOSClusterizer");
- SetTitle("Version 1") ;
+
fNumberOfCpvClusters = 0 ;
fNumberOfEmcClusters = 0 ;
fToUnfold = kTRUE ;
- fHeaderFileName = headerFile ;
- fDigitsBranchTitle = digitsFile ;
+ fHeaderFileName = GetTitle() ;
+ fDigitsBranchTitle = GetName() ;
- fIsInitialized = kFALSE ;
+ TString tempo(GetName()) ;
+ tempo.Append(Version()) ;
+ SetName(tempo.Data()) ;
Init() ;
}
+
//____________________________________________________________________________
void AliPHOSClusterizerv1::Exec(Option_t * option)
{
- // Steering function
+ // Steering method
- if(!fIsInitialized) Init() ;
+ if( strcmp(GetName(), "")== 0 )
+ Init() ;
if(strstr(option,"tim"))
- gBenchmark->Start("PHOSClusterizer");
+ gBenchmark->Start("PHOSClusterizerv1");
- Int_t nEvents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ if(strstr(option,"print"))
+ Print("") ;
+
+ //check, if the branch with name of this" already exits?
+ TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
- for(fEvent = 0;fEvent< nEvents; fEvent++){
- if(!ReadDigits()) //reads digits for event fEvent
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+
+ while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ phosemcfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ phoscpvfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ clusterizerfound = kTRUE ;
+ }
+
+ if ( phoscpvfound || phosemcfound || clusterizerfound ) {
+ cerr << "WARNING: AliPHOSClusterizer::Exec -> Emc(Cpv)RecPoints and/or Clusterizer branch with name "
+ << taskName.Data() << " already exits" << endl ;
+ return ;
+ }
+
+ Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t ievent ;
+
+ for(ievent = 0; ievent < nevents; ievent++){
+
+ if(!ReadDigits(ievent)) //reads digits for event fEvent
return;
+
MakeClusters() ;
- if(fToUnfold) MakeUnfolding() ;
- WriteRecPoints() ;
+ if(fToUnfold)
+ MakeUnfolding() ;
+
+ WriteRecPoints(ievent) ;
+
if(strstr(option,"deb"))
PrintRecPoints(option) ;
}
gBenchmark->Stop("PHOSClusterizer");
cout << "AliPHOSClusterizer:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing "
- << gBenchmark->GetCpuTime("PHOSClusterizer")/nEvents << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("PHOSClusterizer")/nevents << " seconds per event " << endl ;
cout << endl ;
}
// The initial values for fitting procedure are set equal to the positions of local maxima.
// Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ 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(fDigits,1) ;
+ toMinuit->AddAt(digits,1) ;
gMinuit->SetObjectFit(toMinuit) ; // To tranfer pointer to UnfoldingChiSquare
Int_t iDigit ;
+ const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
for(iDigit = 0; iDigit < nDigits; iDigit++){
digit = (AliPHOSDigit *) maxAt[iDigit];
Int_t relid[4] ;
- Float_t x ;
- Float_t z ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, x, z) ;
+ Float_t x = 0.;
+ Float_t z = 0.;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->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
+
+ if ( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
- if(!fIsInitialized){
- if(fHeaderFileName.IsNull())
- fHeaderFileName = "galice.root" ;
-
- TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data() ) ;
-
- if(file == 0){
- if(fHeaderFileName.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFileName.Data(),"update") ;
- else
- file = new TFile(fHeaderFileName.Data(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ;
- }
-
- AliPHOS * phos = (AliPHOS *) gAlice->GetDetector("PHOS") ;
- fGeom = AliPHOSGeometry::GetInstance(phos->GetGeometry()->GetName(),phos->GetGeometry()->GetTitle() );
-
- fDigits = new TClonesArray("AliPHOSDigit",10) ;
- fDigitizer = new AliPHOSDigitizer() ;
- fEmcRecPoints = new TObjArray(200) ;
- fCpvRecPoints = new TObjArray(200) ;
- fEmcRecPoints->SetOwner(); // This lets Clear() really detete rec.points in array
- fCpvRecPoints->SetOwner();
-
- if(!gMinuit) gMinuit = new TMinuit(100) ;
-
- //add Task to //YSAlice/tasks/Reconstructioner/PHOS
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceRe = (TTask*)alice->FindObject("tasks/Reconstructioner") ;
- TTask * phosRe = (TTask*)aliceRe->GetListOfTasks()->FindObject("PHOS") ;
- phosRe->Add(this) ;
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
- fIsInitialized = kTRUE ;
- }
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliPHOSClusterizerv1::Init -> Could not obtain the Getter object !" << endl ;
+ return ;
+ }
+
+ if(!gMinuit)
+ gMinuit = new TMinuit(100) ;
+
+ //add Task to //YSAlice/tasks/Reconstructioner/PHOS
+ TTask * aliceRe = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Reconstructioner") ;
+ TTask * phosRe = (TTask*)aliceRe->GetListOfTasks()->FindObject("PHOS") ;
+ phosRe->Add(this) ;
+ // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/recpointsName
+ gime->Post(GetTitle(), "R", taskName.Data() ) ;
+
}
+
//____________________________________________________________________________
Int_t AliPHOSClusterizerv1::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::GetInstance()->PHOSGeometry() ;
+
Int_t rv = 0 ;
Int_t relid1[4] ;
- fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
+ geom->AbsToRelNumbering(d1->GetId(), relid1) ;
Int_t relid2[4] ;
- fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
+ geom->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] ) ;
//Do NOT clusterize upper PPSD
if( IsInPpsd(d1) && IsInPpsd(d2) &&
relid1[1] > 0 &&
- relid1[1] < fGeom->GetNumberOfPadsPhi()*fGeom->GetNumberOfPadsPhi() ) rv = 2 ;
+ relid1[1] < geom->GetNumberOfPadsPhi()*geom->GetNumberOfPadsPhi() ) rv = 2 ;
return rv ;
}
// Tells if (true) or not (false) the digit is in a PHOS-EMC module
Bool_t rv = kFALSE ;
+ const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
if ( relid[1] == 0 ) rv = kTRUE;
// Tells if (true) or not (false) the digit is in a PHOS-PPSD module
Bool_t rv = kFALSE ;
+ const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
- if ( relid[1] > 0 && relid[0] > fGeom->GetNCPVModules() ) rv = kTRUE;
+ if ( relid[1] > 0 && relid[0] > geom->GetNCPVModules() ) rv = kTRUE;
return rv ;
}
// Tells if (true) or not (false) the digit is in a PHOS-CPV module
Bool_t rv = kFALSE ;
+ const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
- if ( relid[1] > 0 && relid[0] <= fGeom->GetNCPVModules() ) rv = kTRUE;
+ if ( relid[1] > 0 && relid[0] <= geom->GetNCPVModules() ) rv = kTRUE;
return rv ;
}
//____________________________________________________________________________
-Bool_t AliPHOSClusterizerv1::ReadDigits()
+Bool_t AliPHOSClusterizerv1::ReadDigits(Int_t event)
{
// reads digitis with specified title from TreeD
fNumberOfCpvClusters = 0 ;
// Get Digits Tree header from file
- gAlice->GetEvent(fEvent) ;
- gAlice->SetEvent(fEvent) ;
-
- TTree * treeD = gAlice->TreeD() ;
+ gAlice->GetEvent(event) ;
+ gAlice->SetEvent(event) ;
- if(treeD==0){
- char treeName[20];
- sprintf(treeName,"TreeD%d",fEvent);
- cout << "Error in AliPHOSClusterizerv1 : no "<<treeName << endl ;
- cout << " Do nothing " << endl ;
- return kFALSE ;
+ if ( gAlice->TreeD()==0) {
+ cerr << "ERROR: AliPHOSClusterizerv1::ReadDigits There is no Digit Tree" << endl;
+ return kFALSE;
}
-
+
+ //set address of the Digits and Digitizer
TBranch * digitsBranch = 0;
TBranch * digitizerBranch = 0;
-
- TObjArray * branches = treeD->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t digitizerNotFound = kTRUE ;
+ TObjArray * lob = (TObjArray*)gAlice->TreeD()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
- if(phosNotFound){
- digitsBranch=(TBranch *) branches->At(ibranch) ;
- if( fDigitsBranchTitle.CompareTo(digitsBranch->GetTitle())==0 )
- if( strcmp(digitsBranch->GetName(),"PHOS") == 0)
- phosNotFound = kFALSE ;
+ while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phosfound = kTRUE ;
+ digitsBranch = branch ;
}
- if(digitizerNotFound){
- digitizerBranch = (TBranch *) branches->At(ibranch) ;
- if( fDigitsBranchTitle.CompareTo(digitizerBranch->GetTitle()) == 0)
- if( strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0)
- digitizerNotFound = kFALSE ;
+ else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ digitizerfound = kTRUE ;
+ digitizerBranch = branch ;
}
-
}
+ if ( !phosfound || !digitizerfound ) {
+ cerr << "WARNING: AliPHOSClusterizerv1::ReadDigits -> Digits and/or Digitizer branch with name " << taskName.Data()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
- if(digitizerNotFound || phosNotFound){
- cout << "ERROR in AliPHOSClusterizerv1: " << endl ;
- cout << " Can't find Branch with digits or Digitizer "<< endl ; ;
- cout << " Do nothing" <<endl ;
- return kFALSE ;
- }
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ TClonesArray * digits = gime->Digits() ;
+ digits->Clear() ;
+ digitsBranch->SetAddress(&digits) ;
- digitsBranch->SetAddress(&fDigits) ;
- digitizerBranch->SetAddress(&fDigitizer) ;
+ AliPHOSDigitizer * digitizer = gime->Digitizer() ;
+ digitizerBranch->SetAddress(&digitizer) ;
digitsBranch->GetEntry(0) ;
digitizerBranch->GetEntry(0) ;
- fPedestal = fDigitizer->GetPedestal() ;
- fSlope = fDigitizer->GetSlope() ;
+ fPedestal = digitizer->GetPedestal() ;
+ fSlope = digitizer->GetSlope() ;
+
return kTRUE ;
}
//____________________________________________________________________________
-void AliPHOSClusterizerv1::WriteRecPoints()
+void AliPHOSClusterizerv1::WriteRecPoints(Int_t event)
{
- // Checks, if PHOSEmcRP etc. branches with given title already exist,
- // if yes exits without writing,
- // else creates new branches with given title
+
+ // Creates new branches with given title
// fills and writes into TreeR.
+ AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ TClonesArray * digits = gime->Digits() ;
+
Int_t index ;
//Evaluate poisition, dispersion and other RecPoint properties...
- for(index = 0; index < fEmcRecPoints->GetEntries(); index++)
- ((AliPHOSEmcRecPoint *)fEmcRecPoints->At(index))->EvalAll(fW0,fDigits) ;
+ for(index = 0; index < emcRecPoints->GetEntries(); index++)
+ ((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->EvalAll(fW0,digits) ;
- fEmcRecPoints->Sort() ;
+ emcRecPoints->Sort() ;
- for(index = 0; index < fEmcRecPoints->GetEntries(); index++)
- ((AliPHOSEmcRecPoint *)fEmcRecPoints->At(index))->SetIndexInList(index) ;
+ for(index = 0; index < emcRecPoints->GetEntries(); index++)
+ ((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->SetIndexInList(index) ;
- fEmcRecPoints->Expand(fEmcRecPoints->GetEntriesFast()) ;
+ emcRecPoints->Expand(emcRecPoints->GetEntriesFast()) ;
//Now the same for CPV
- for(index = 0; index < fCpvRecPoints->GetEntries(); index++)
- ((AliPHOSRecPoint *)fCpvRecPoints->At(index))->EvalAll(fW0CPV,fDigits) ;
+ for(index = 0; index < cpvRecPoints->GetEntries(); index++)
+ ((AliPHOSRecPoint *)cpvRecPoints->At(index))->EvalAll(fW0CPV,digits) ;
- fCpvRecPoints->Sort() ;
+ cpvRecPoints->Sort() ;
- for(index = 0; index < fCpvRecPoints->GetEntries(); index++)
- ((AliPHOSRecPoint *)fCpvRecPoints->At(index))->SetIndexInList(index) ;
+ for(index = 0; index < cpvRecPoints->GetEntries(); index++)
+ ((AliPHOSRecPoint *)cpvRecPoints->At(index))->SetIndexInList(index) ;
- fCpvRecPoints->Expand(fCpvRecPoints->GetEntriesFast()) ;
+ cpvRecPoints->Expand(cpvRecPoints->GetEntriesFast()) ;
+ gAlice->GetEvent(event) ;
if(gAlice->TreeR()==0)
gAlice->MakeTree("R") ;
-
- //Check, if branches already exist
- TBranch * emcBranch = 0;
- TBranch * cpvBranch = 0;
- TBranch * clusterizerBranch = 0;
-
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t emcNotFound = kTRUE ;
- Bool_t cpvNotFound = kTRUE ;
- Bool_t clusterizerNotFound = kTRUE ;
-
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-
- if(emcNotFound){
- emcBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(emcBranch->GetTitle())==0 ){
- if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0) {
- emcNotFound = kFALSE ;
- }
- }
- }
- if(cpvNotFound){
- cpvBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(cpvBranch->GetTitle())==0 ){
- if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0) {
- cpvNotFound = kFALSE ;
- }
- }
- }
-
- if(clusterizerNotFound){
- clusterizerBranch = (TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(clusterizerBranch->GetTitle()) == 0){
- if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0) {
- clusterizerNotFound = kFALSE ;
- }
- }
- }
-
- }
-
- if(!(clusterizerNotFound && emcNotFound && cpvNotFound)){
- cout << "AliPHOSClusterizer error" << endl;
- cout << " Branches PHOSEmcRP, PHOSCpvRP and AliPHOSClusterizer " << endl ;
- cout << " with title '" << fRecPointsBranchTitle.Data() <<"' already exist" << endl ;
- cout << " can not overwrite " << endl ;
- return ;
- }
-
//Make branches in TreeR for RecPoints and Clusterizer
char * filename = 0;
if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
//Make new branches
TDirectory *cwd = gDirectory;
+ TString branchName(GetName()) ;
+ branchName.ReplaceAll(Version(), "") ;
+
//First EMC
Int_t bufferSize = 32000 ;
Int_t splitlevel = 0 ;
- emcBranch = gAlice->TreeR()->Branch("PHOSEmcRP","TObjArray",&fEmcRecPoints,bufferSize,splitlevel);
- emcBranch->SetTitle(fRecPointsBranchTitle.Data());
+ TBranch * emcBranch = gAlice->TreeR()->Branch("PHOSEmcRP","TObjArray",&emcRecPoints,bufferSize,splitlevel);
+ emcBranch->SetTitle(branchName);
if (filename) {
emcBranch->SetFile(filename);
TIter next( emcBranch->GetListOfBranches());
}
//Now CPV branch
- cpvBranch = gAlice->TreeR()->Branch("PHOSCpvRP","TObjArray",&fCpvRecPoints,bufferSize,splitlevel);
- cpvBranch->SetTitle(fRecPointsBranchTitle.Data());
+ TBranch * cpvBranch = gAlice->TreeR()->Branch("PHOSCpvRP","TObjArray",&cpvRecPoints,bufferSize,splitlevel);
+ cpvBranch->SetTitle(branchName);
if (filename) {
cpvBranch->SetFile(filename);
TIter next( cpvBranch->GetListOfBranches());
}
//And Finally clusterizer branch
- AliPHOSClusterizerv1 * cl = this ;
- clusterizerBranch = gAlice->TreeR()->Branch("AliPHOSClusterizer","AliPHOSClusterizerv1",
+ AliPHOSClusterizerv1 * cl = (AliPHOSClusterizerv1*)gime->Clusterizer(GetName()) ;
+ TBranch * clusterizerBranch = gAlice->TreeR()->Branch("AliPHOSClusterizer","AliPHOSClusterizerv1",
&cl,bufferSize,splitlevel);
- clusterizerBranch->SetTitle(fRecPointsBranchTitle.Data());
+ clusterizerBranch->SetTitle(branchName);
if (filename) {
clusterizerBranch->SetFile(filename);
TIter next( clusterizerBranch->GetListOfBranches());
{
// Steering method to construct the clusters stored in a list of Reconstructed Points
// A cluster is defined as a list of neighbour digits
- fEmcRecPoints->Clear() ;
- fCpvRecPoints->Clear() ;
-
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ emcRecPoints->Clear() ;
+ cpvRecPoints->Clear() ;
+
+ TClonesArray * digits = gime->Digits() ;
+ TClonesArray * digitsC = (TClonesArray*)digits->Clone() ;
+
+
// Clusterization starts
- TClonesArray * digits = (TClonesArray*)fDigits->Clone() ;
- TIter nextdigit(digits) ;
+ TIter nextdigit(digitsC) ;
AliPHOSDigit * digit ;
Bool_t notremoved = kTRUE ;
- while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
+ while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digitsC
AliPHOSRecPoint * clu = 0 ;
TArrayI clusterdigitslist(1500) ;
( IsInCpv (digit) && Calibrate(digit->GetAmp()) > fCpvClusteringThreshold ) ) {
Int_t iDigitInCluster = 0 ;
-
+
if ( IsInEmc(digit) ) {
// start a new EMC RecPoint
- if(fNumberOfEmcClusters >= fEmcRecPoints->GetSize()) fEmcRecPoints->Expand(2*fNumberOfEmcClusters+1) ;
- fEmcRecPoints->AddAt(new AliPHOSEmcRecPoint(), fNumberOfEmcClusters) ;
- clu = (AliPHOSEmcRecPoint *) fEmcRecPoints->At(fNumberOfEmcClusters) ;
+ if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
+ emcRecPoints->Expand(2*fNumberOfEmcClusters+1) ;
+
+ emcRecPoints->AddAt(new AliPHOSEmcRecPoint(), fNumberOfEmcClusters) ;
+ clu = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters) ;
fNumberOfEmcClusters++ ;
clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
iDigitInCluster++ ;
- digits->Remove(digit) ;
+ digitsC->Remove(digit) ;
} else {
// start a new PPSD/CPV cluster
- if(fNumberOfCpvClusters >= fCpvRecPoints->GetSize()) fCpvRecPoints->Expand(2*fNumberOfCpvClusters+1);
+ if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
+ cpvRecPoints->Expand(2*fNumberOfCpvClusters+1);
+
if(IsInPpsd(digit))
- fCpvRecPoints->AddAt(new AliPHOSPpsdRecPoint(),fNumberOfCpvClusters) ;
+ cpvRecPoints->AddAt(new AliPHOSPpsdRecPoint(),fNumberOfCpvClusters) ;
else
- fCpvRecPoints->AddAt(new AliPHOSCpvRecPoint(), fNumberOfCpvClusters) ;
- clu = (AliPHOSPpsdRecPoint *) fCpvRecPoints->At(fNumberOfCpvClusters) ;
- fNumberOfCpvClusters++ ;
+ cpvRecPoints->AddAt(new AliPHOSCpvRecPoint(), fNumberOfCpvClusters) ;
+ clu = (AliPHOSPpsdRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters) ;
+ fNumberOfCpvClusters++ ;
clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
iDigitInCluster++ ;
- digits->Remove(digit) ;
+ digitsC->Remove(digit) ;
nextdigit.Reset() ;
- // Here we remove resting EMC digits, which cannot make cluster
+ // Here we remove remaining EMC digits, which cannot make a cluster
if( notremoved ) {
while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
if( IsInEmc(digit) )
- digits->Remove(digit) ;
+ digitsC->Remove(digit) ;
else
break ;
}
AliPHOSDigit * digitN ;
index = 0 ;
while (index < iDigitInCluster){ // scan over digits already in cluster
- digit = (AliPHOSDigit*)fDigits->At(clusterdigitslist[index]) ;
+ digit = (AliPHOSDigit*)digits->At(clusterdigitslist[index]) ;
index++ ;
while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ;
iDigitInCluster++ ;
- digits->Remove(digitN) ;
+ digitsC->Remove(digitN) ;
break ;
case 2 : // too far from each other
goto endofloop;
} // while digit
- delete digits ;
+ delete digitsC ;
}
// Unfolds clusters using the shape of an ElectroMagnetic shower
// Performs unfolding of all EMC/CPV but NOT ppsd clusters
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ 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 = fGeom->GetNModules() ;
+ Int_t nModulesToUnfold = geom->GetNModules() ;
Int_t numberofNotUnfolded = fNumberOfEmcClusters ;
Int_t index ;
for(index = 0 ; index < numberofNotUnfolded ; index++){
- AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint *) fEmcRecPoints->At(index) ;
+ AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint *) emcRecPoints->At(index) ;
if(emcRecPoint->GetPHOSMod()> nModulesToUnfold)
break ;
Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
Int_t * maxAt = new Int_t[nMultipl] ;
Float_t * maxAtEnergy = new Float_t[nMultipl] ;
- Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,fDigits) ;
+ Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,digits) ;
if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
- fEmcRecPoints->Remove(emcRecPoint);
- fEmcRecPoints->Compress() ;
+ emcRecPoints->Remove(emcRecPoint);
+ emcRecPoints->Compress() ;
index-- ;
fNumberOfEmcClusters -- ;
numberofNotUnfolded-- ;
// Unfold now CPV clusters
if(fNumberOfCpvClusters > 0){
- Int_t nModulesToUnfold = fGeom->GetNCPVModules() ;
+ Int_t nModulesToUnfold = geom->GetNCPVModules() ;
Int_t numberofCpvNotUnfolded = fNumberOfCpvClusters ;
Int_t index ;
for(index = 0 ; index < numberofCpvNotUnfolded ; index++){
- AliPHOSRecPoint * recPoint = (AliPHOSRecPoint *) fCpvRecPoints->At(index) ;
+ AliPHOSRecPoint * recPoint = (AliPHOSRecPoint *) cpvRecPoints->At(index) ;
if(recPoint->GetPHOSMod()> nModulesToUnfold)
break ;
Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
Int_t * maxAt = new Int_t[nMultipl] ;
Float_t * maxAtEnergy = new Float_t[nMultipl] ;
- Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,fDigits) ;
+ Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,digits) ;
if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
- fCpvRecPoints->Remove(emcRecPoint);
- fCpvRecPoints->Compress() ;
+ cpvRecPoints->Remove(emcRecPoint);
+ cpvRecPoints->Compress() ;
index-- ;
numberofCpvNotUnfolded-- ;
fNumberOfCpvClusters-- ;
{
// Performs the unfolding of a cluster with nMax overlapping showers
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
+ 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 nDigits = iniEmc->GetMultiplicity() ;
Float_t * efit = new Float_t[nDigits] ;
- Float_t xDigit,zDigit,distance ;
- Float_t xpar,zpar,epar ;
+ Float_t xDigit=0.,zDigit=0.,distance=0. ;
+ Float_t xpar=0.,zpar=0.,epar=0. ;
Int_t relid[4] ;
- AliPHOSDigit * digit ;
+ AliPHOSDigit * digit = 0 ;
Int_t * emcDigits = iniEmc->GetDigitsList() ;
Int_t iparam ;
Int_t iDigit ;
for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
- digit = (AliPHOSDigit*) fDigits->At(emcDigits[iDigit] ) ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, xDigit, zDigit) ;
+ digit = (AliPHOSDigit*) digits->At(emcDigits[iDigit] ) ;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->RelPosInModule(relid, xDigit, zDigit) ;
efit[iDigit] = 0;
iparam = 0 ;
epar = fitparameters[iparam+2] ;
iparam += 3 ;
- AliPHOSEmcRecPoint * emcRP ;
+ AliPHOSEmcRecPoint * emcRP = 0 ;
if(iniEmc->IsEmc()){ //create new entries in fEmcRecPoints...
- if(fNumberOfEmcClusters >= fEmcRecPoints->GetSize())
- fEmcRecPoints->Expand(2*fNumberOfEmcClusters) ;
+ if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
+ emcRecPoints->Expand(2*fNumberOfEmcClusters) ;
- (*fEmcRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint() ;
- emcRP = (AliPHOSEmcRecPoint *) fEmcRecPoints->At(fNumberOfEmcClusters);
+ (*emcRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint() ;
+ emcRP = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters);
fNumberOfEmcClusters++ ;
}
else{//create new entries in fCpvRecPoints
- if(fNumberOfCpvClusters >= fCpvRecPoints->GetSize())
- fCpvRecPoints->Expand(2*fNumberOfCpvClusters) ;
+ if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
+ cpvRecPoints->Expand(2*fNumberOfCpvClusters) ;
- (*fCpvRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint() ;
- emcRP = (AliPHOSEmcRecPoint *) fCpvRecPoints->At(fNumberOfCpvClusters);
+ (*cpvRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint() ;
+ emcRP = (AliPHOSEmcRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters);
fNumberOfCpvClusters++ ;
}
Float_t eDigit ;
for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
- digit = (AliPHOSDigit*) fDigits->At( emcDigits[iDigit] ) ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, xDigit, zDigit) ;
+ digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ;
+ geom->AbsToRelNumbering(digit->GetId(), relid) ;
+ geom->RelPosInModule(relid, xDigit, zDigit) ;
distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
distance = TMath::Sqrt(distance) ;
ratio = epar * ShowerShape(distance) / efit[iDigit] ;
Int_t * emcDigits = emcRP->GetDigitsList() ;
- Int_t nOfDigits = emcRP->GetDigitsMultiplicity() ;
+ Int_t nOdigits = emcRP->GetDigitsMultiplicity() ;
Float_t * emcEnergies = emcRP->GetEnergiesList() ;
AliPHOSDigit * digit ;
Int_t iDigit ;
- for( iDigit = 0 ; iDigit < nOfDigits ; iDigit++) {
+ for( iDigit = 0 ; iDigit < nOdigits ; iDigit++) {
digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ;
{
// Print clusterizer parameters
- if(fIsInitialized){
+ if( strcmp(GetName(), "") !=0 ){
// Print parameters
-
- cout << "---------------"<< GetName() << " " << GetTitle()<< "-----------" << endl
+
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+
+ cout << "---------------"<< taskName.Data() << " " << GetTitle()<< "-----------" << endl
<< "Clusterizing digits from the file: " << fHeaderFileName.Data() << endl
<< " Branch: " << fDigitsBranchTitle.Data() << endl
<< endl
{
// Prints list of RecPoints produced at the current pass of AliPHOSClusterizer
+ TObjArray * emcRecPoints = AliPHOSGetter::GetInstance()->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = AliPHOSGetter::GetInstance()->CpvRecPoints() ;
+
cout << "AliPHOSClusterizerv1: " << endl ;
- cout << " Found "<< fEmcRecPoints->GetEntriesFast() << " EMC Rec Points and "
- << fCpvRecPoints->GetEntriesFast() << " CPV RecPoints" << endl ;
+ cout << " Found "<< emcRecPoints->GetEntriesFast() << " EMC Rec Points and "
+ << cpvRecPoints->GetEntriesFast() << " CPV RecPoints" << endl ;
if(strstr(option,"all")) {
cout << "EMC clusters " << endl ;
<< " Primaries list " << endl;
Int_t index ;
- for (index = 0 ; index < fEmcRecPoints->GetEntries() ; index++) {
- AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )fEmcRecPoints->At(index) ;
+ for (index = 0 ; index < emcRecPoints->GetEntries() ; index++) {
+ AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )emcRecPoints->At(index) ;
cout << setw(6) << rp->GetIndexInList() << " ";
cout << setw(6) << rp->GetEnergy() << " ";
}
cout << endl ;
- //Now plot PCV/PPSD recPoints
+ //Now plot CPV/PPSD recPoints
cout << "EMC clusters " << endl ;
cout << " Index "
<< " Multi "
<< " # of prim "
<< " Primaries list " << endl;
- for (index = 0 ; index < fEmcRecPoints->GetEntries() ; index++) {
- AliPHOSRecPoint * rp = (AliPHOSRecPoint * )fCpvRecPoints->At(index) ;
+ for (index = 0 ; index < cpvRecPoints->GetEntries() ; index++) {
+ AliPHOSRecPoint * rp = (AliPHOSRecPoint * )cpvRecPoints->At(index) ;
cout << setw(6) << rp->GetIndexInList() << " ";
cout << setw(6) << rp->GetPHOSMod() << " ";
public:
AliPHOSClusterizerv1() ; // ctor
- AliPHOSClusterizerv1(const char * headerFile,const char *digitsBrancheTitle=0);
+ AliPHOSClusterizerv1(const char * headerFile, const char * name = 0);
virtual ~AliPHOSClusterizerv1(){} // dtor
Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ;
virtual void SetCpvLocalMaxCut(Float_t cut) { fCpvLocMaxCut = cut ; }
virtual void SetCpvLogWeight(Float_t w) { fW0CPV = w ; }
virtual void SetPpsdClusteringThreshold(Float_t cluth) { fPpsdClusteringThreshold = cluth ; }
-
virtual void SetDigitsBranch(const char * title) { fDigitsBranchTitle = title ;}
virtual void SetRecPointsBranch(const char *title){fRecPointsBranchTitle = title; }
-
virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;}
-
- 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 passes to MINUIT
static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding;
//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 passes to MINUIT
+ virtual const char * Version() const { return "clu-v1" ; }
+
private:
+
virtual Float_t Calibrate(Int_t amp)const { return (amp-fPedestal)/fSlope ;} // Tranforms Amp to energy
Bool_t FindFit(AliPHOSEmcRecPoint * emcRP, int * MaxAt, Float_t * maxAtEnergy,
Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
virtual void MakeClusters( ) ;
virtual void MakeUnfolding() ;
- Bool_t ReadDigits() ;
+ Bool_t ReadDigits(Int_t event) ;
void UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax,
int * maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
- void WriteRecPoints() ;
+ void WriteRecPoints(Int_t event) ;
void PrintRecPoints(Option_t * option) ;
private:
TString fDigitsBranchTitle ; // name of the file, where digits branch is stored
TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored
- Int_t fEvent ; // Number of event currently processed
Bool_t fToUnfold ; // To perform unfolding
- Bool_t fIsInitialized ; // kTRUE if clisterizer is initialized
-
- AliPHOSGeometry * fGeom ; // !pointer to PHOS geometry
-
- AliPHOSDigitizer * fDigitizer ; // !digitizer which produced Digits we treat
Int_t fNumberOfEmcClusters ; // number of EMC clusters found
Int_t fNumberOfCpvClusters ; // number of CPV+PPSD clusters found
- TClonesArray * fDigits ; // ! Initial list of digits
- TObjArray * fEmcRecPoints ; // ! Final list of EMC Rec Points
- TObjArray * fCpvRecPoints ; // ! Final list of CPV/PPSD recPoints
-
+
Float_t fPedestal ; // Calibration parameters
Float_t fSlope ; // read from Digitizer
// // static Int_t pxold, pyold;
-// AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
// static TGraph * digitgraph = 0 ;
// Float_t zimin = 999. ;
// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
-// digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ;
+// digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
// phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
// phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
// if ( xi[iDigit] > ximax )
// Float_t x, z ;
// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
-// digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ;
+// digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
// phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
// phosgeom->RelPosInModule(relid, x, z);
// histo->Fill(x, z, fEnergyList[iDigit] ) ;
#include "AliPHOSDigit.h"
#include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSGeometry.h"
class AliPHOSCpvRecPoint : public AliPHOSEmcRecPoint {
}
//____________________________________________________________________________
-AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t DigEnergy, Int_t index)
+AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t digEnergy, Int_t index)
{
// ctor with all data
fNMaxPrimary = 5 ;
- fAmp = DigEnergy ;
+ fAmp = digEnergy ;
fId = id ;
fIndexInList = index ;
if( primary != -1){
// This TTask performs digitization of Summable digits (in the PHOS case it is just
// the sum of contributions from all primary particles into a given cell).
// In addition it performs mixing of summable digits from different events.
+// The name of the TTask is also the title of the branch that will contain
+// the created SDigits
+// The title of the TTAsk is the name of the file that contains the hits from
+// which the SDigits are created
//
// For each event two branches are created in TreeD:
// "PHOS" - list of digits
#include "AliRun.h"
#include "AliPHOSDigit.h"
#include "AliPHOS.h"
+#include "AliPHOSGetter.h"
#include "AliPHOSDigitizer.h"
#include "AliPHOSSDigitizer.h"
#include "AliPHOSGeometry.h"
//____________________________________________________________________________
- AliPHOSDigitizer::AliPHOSDigitizer():TTask("AliPHOSDigitizer","")
+ AliPHOSDigitizer::AliPHOSDigitizer():TTask("","")
{
// ctor
- fSDigitizer = 0 ;
-
- fNinputs = 1 ;
fPinNoise = 0.01 ;
fEMCDigitThreshold = 0.01 ;
fCPVNoise = 0.01;
fCPVDigitThreshold = 0.09 ;
fPPSDNoise = 0.0000001;
fPPSDDigitThreshold = 0.0000002 ;
- fInitialized = kFALSE ;
-
- fHeaderFiles = 0;
- fSDigitsTitles = 0;
- fSDigits = 0 ;
- fDigits = 0;
-
-}
-//____________________________________________________________________________
-void AliPHOSDigitizer::Init()
-{
- // Makes all memory allocations
- // Adds Digitizer task to the folder of PHOS tasks
-
- if(!fInitialized){
-
- if (fHeaderFiles == 0) {
- fHeaderFiles = new TClonesArray("TObjString",1) ;
- new((*fHeaderFiles)[0]) TObjString("galice.root") ;
- }
-
- //Test, if this file already open
-
- TFile *file = (TFile*) gROOT->GetFile(((TObjString *) fHeaderFiles->At(0))->GetString() ) ;
-
- if(file==0){
- if(((TObjString *) fHeaderFiles->At(0))->GetString().Contains("rfio"))
- file = TFile::Open(((TObjString *) fHeaderFiles->At(0))->GetString(),"update") ;
- else
- file = new TFile(((TObjString *) fHeaderFiles->At(0))->GetString(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ; //If not read yet
- }
- else
- file = new TFile(((TObjString *) fHeaderFiles->At(0))->GetString()) ;
-
- file->cd() ;
-
- if (fSDigitsTitles == 0) {
- fSDigitsTitles = new TClonesArray("TObjString",1);
- new((*fSDigitsTitles)[0]) TObjString("") ;
- }
-
- fSDigits = new TClonesArray("TClonesArray",1) ;
- new((*fSDigits)[0]) TClonesArray("AliPHOSDigit",1000) ;
- fSDigitizer = 0 ;
-
- fDigitsTitle = "" ;
-
- fDigits = new TClonesArray("AliPHOSDigit",200000) ;
-
- fIevent = new TArrayI(1) ;
- fIevent->AddAt(-1,0 ) ;
- fIeventMax = new TArrayI(1) ;
-
- fIeventMax->AddAt((Int_t) gAlice->TreeE()->GetEntries(), 0 );
-
- //add Task to //YSAlice/tasks/(S)Diditizer/PHOS
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceSD = (TTask*)alice->FindObject("tasks/(S)Digitizer") ;
- TTask * phosSD = (TTask*)aliceSD->GetListOfTasks()->FindObject("PHOS") ;
- phosSD->Add(this) ;
-
- fInitialized = kTRUE ;
- }
}
//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char *sDigitsTitle):
- TTask("AliPHOSDigitizer","")
+AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name):
+ TTask(name, headerFile)
{
// ctor
- fHeaderFiles = new TClonesArray("TObjString",1) ;
- new((*fHeaderFiles)[0]) TObjString(headerFile) ;
-
- fSDigitsTitles = new TClonesArray("TObjString",1); // Title name of the SDigits branch
- new((*fSDigitsTitles)[0]) TObjString(sDigitsTitle) ;
-
- fNinputs = 1 ;
+
fPinNoise = 0.01 ;
fEMCDigitThreshold = 0.01 ;
fCPVNoise = 0.01;
fCPVDigitThreshold = 0.09 ;
fPPSDNoise = 0.0000001;
fPPSDDigitThreshold = 0.0000002 ;
- fInitialized = kFALSE ;
Init() ;
{
// dtor
- if(fHeaderFiles) delete fHeaderFiles ;
- if(fSDigitsTitles) delete fSDigitsTitles ;
- if(fSDigits) delete fSDigits ;
- if(fDigits) delete fDigits ;
-}
-//____________________________________________________________________________
-void AliPHOSDigitizer::Reset()
-{
- // sets current event number to the first simulated event
-
- if(!fInitialized)
- Init() ;
- Int_t inputs ;
- for(inputs = 0; inputs < fNinputs ;inputs++)
- fIevent->AddAt(-1, inputs ) ;
-
-}
-//____________________________________________________________________________
-Bool_t AliPHOSDigitizer::Combinator()
-{
- // Makes all desirable combinations of Signal+Background,
- // returns kFALSE when all combinations are made.
- // May be useful to introduce options like "One-to-One", "All-to-One" and "All-to-All" ?
- //realizing "One-to-One" option...
-
- if(!fInitialized)
- Init() ;
-
- Int_t inputs ;
- Bool_t endNotReached = kTRUE ;
-
- for(inputs = 0; (inputs < fNinputs) && endNotReached ;inputs++){
- if(fIevent->At(inputs)+1 < fIeventMax->At(inputs))
- fIevent->AddAt(fIevent->At(inputs)+1, inputs ) ;
- else
- if(inputs == 0)
- endNotReached = kFALSE ;
- else //for inputs other than base one start from the beginning
- fIevent->AddAt(0, inputs ) ;
-
- }
- return endNotReached ;
-
}
//____________________________________________________________________________
-void AliPHOSDigitizer::Digitize(Option_t *option)
+void AliPHOSDigitizer::Digitize(const Int_t event)
{
// Makes the digitization of the collected summable digits.
// This design avoids scanning over the list of digits to add
// contribution to new SDigits only.
- if(!fInitialized)
+ if( strcmp(GetName(), "") == 0 )
Init() ;
- fDigits->Clear() ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * digits = gime->Digits() ;
+
+ digits->Clear() ;
- AliPHOS * phos = (AliPHOS *) gAlice->GetDetector("PHOS") ;
- AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() );
+ const AliPHOSGeometry *geom = gime->PHOSGeometry() ;
//Making digits with noise, first EMC
Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
nPPSD = nCPV;
- fDigits->Expand(nPPSD) ;
+ digits->Expand(nPPSD) ;
-
+
+ // sdigitize random gaussian noise and add it to all cells (EMCA+CPV+PPSD)
+ // get first the sdigitizer from the tasks list (must have same name as the digitizer)
+ const AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(GetName());
+ if ( !sDigitizer) {
+ cerr << "ERROR: AliPHOSDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
+ abort() ;
+ }
for(absID = 1; absID <= nEMC; absID++){
Float_t noise = gRandom->Gaus(0., fPinNoise) ;
- new((*fDigits)[absID-1]) AliPHOSDigit( -1,absID,fSDigitizer->Digitize(noise) ) ;
+ new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise) ) ;
}
for(absID = nEMC+1; absID <= nCPV; absID++){
Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
- new((*fDigits)[absID-1]) AliPHOSDigit( -1,absID,fSDigitizer->Digitize(noise) ) ;
+ new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise) ) ;
}
for(absID = nCPV+1; absID <= nPPSD; absID++){
Float_t noise = gRandom->Gaus(0., fPPSDNoise) ;
- new((*fDigits)[absID-1]) AliPHOSDigit( -1,absID,fSDigitizer->Digitize(noise) ) ;
+ new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise) ) ;
}
-
- // Now look throught (unsorted) list of SDigits and add corresponding digits
- AliPHOSDigit *curSDigit ;
- AliPHOSDigit *digit ;
-
- Int_t inputs;
- for(inputs = 0; inputs< fNinputs ; inputs++){ //loop over (possible) merge sources
-
- TClonesArray * sdigits= (TClonesArray *)fSDigits->At(inputs) ;
- Int_t isdigit ;
-
- Int_t nSDigits = sdigits->GetEntries() ;
- for(isdigit=0;isdigit< nSDigits; isdigit++){
- curSDigit = (AliPHOSDigit *)sdigits->At(isdigit) ;
- if(inputs) //Shift primaries for non-background sdigits
- curSDigit->ShiftPrimary(inputs) ;
- digit = (AliPHOSDigit *)fDigits->At(curSDigit->GetId() - 1);
- *digit = *digit + *curSDigit ;
- }
+ // loop through the sdigits posted to the White Board and add them to the noise
+ TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS"))->GetListOfFolders() ;
+ TIter next(folderslist) ;
+ TFolder * folder = 0 ;
+ TClonesArray * sdigits = 0 ;
+ TString eventS ;
+ eventS += event ;
+ while ( (folder = (TFolder*)next()) ) {
+ if ( (strcmp(folder->GetTitle(), eventS.Data()) == 0) || (strcmp(folder->GetTitle(), "") == 0) ) {
+ Int_t numberoffiles = 0 ;
+ if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
+ cout << "INFO: AliPHOSDigitizer::Exec -> Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
+ numberoffiles++ ;
+ Int_t index ;
+ AliPHOSDigit * curSDigit ;
+ AliPHOSDigit * digit ;
+ for ( index = 0 ; index < sdigits->GetEntriesFast(); index++) {
+ curSDigit = (AliPHOSDigit*)sdigits->At(index) ;
+ curSDigit->ShiftPrimary(numberoffiles) ;
+ digit = (AliPHOSDigit*)digits->At(curSDigit->GetId() - 1 ) ;
+ *digit = *digit + *curSDigit ;
+ }
+ }
+ }
}
-
-
//remove digits below thresholds
for(absID = 0; absID < nEMC ; absID++)
- if(fSDigitizer->Calibrate(((AliPHOSDigit*)fDigits->At(absID))->GetAmp()) < fEMCDigitThreshold)
- fDigits->RemoveAt(absID) ;
+ if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(absID))->GetAmp()) < fEMCDigitThreshold)
+ digits->RemoveAt(absID) ;
+
for(absID = nEMC; absID < nCPV ; absID++)
- if(fSDigitizer->Calibrate(((AliPHOSDigit*)fDigits->At(absID))->GetAmp()) < fCPVDigitThreshold)
- fDigits->RemoveAt(absID) ;
+ if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(absID))->GetAmp()) < fCPVDigitThreshold)
+ digits->RemoveAt(absID) ;
+
for(absID = nCPV; absID < nPPSD ; absID++)
- if(fSDigitizer->Calibrate(((AliPHOSDigit *)fDigits->At(absID))->GetAmp()) < fPPSDDigitThreshold)
- fDigits->RemoveAt(absID) ;
+ if(sDigitizer->Calibrate(((AliPHOSDigit *)digits->At(absID))->GetAmp()) < fPPSDDigitThreshold)
+ digits->RemoveAt(absID) ;
- fDigits->Compress() ;
+ digits->Compress() ;
- Int_t ndigits = fDigits->GetEntriesFast() ;
+ Int_t ndigits = digits->GetEntriesFast() ;
- fDigits->Expand(ndigits) ;
+ digits->Expand(ndigits) ;
//Set indexes in list of digits
Int_t i ;
for (i = 0 ; i < ndigits ; i++) {
- AliPHOSDigit * digit = (AliPHOSDigit *) fDigits->At(i) ;
+ AliPHOSDigit * digit = (AliPHOSDigit *) digits->At(i) ;
digit->SetIndexInList(i) ;
}
-}
-//____________________________________________________________________________
-void AliPHOSDigitizer::WriteDigits()
-{
-
- // Makes TreeD in the output file.
- // Check if branch already exists:
- // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
- // already existing branches.
- // else creates branch with Digits, named "PHOS", title "...",
- // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
- // and names of files, from which digits are made.
- gAlice->GetEvent(fIevent->At(0)) ; // Suitable only for One-To-One mixing
- gAlice->SetEvent(fIevent->At(0)) ; // for all-to-all will produce a lot of branches in TreeD
+}
- if(gAlice->TreeD()==0)
- gAlice->MakeTree("D") ;
+//____________________________________________________________________________
+void AliPHOSDigitizer::Exec(Option_t *option)
+{
+ // Managing method
- //Check, if this branch already exits?
- TBranch * digitsBranch = 0;
- TBranch * digitizerBranch = 0;
-
- TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t digitizerNotFound = kTRUE ;
+ if( strcmp(GetName(), "") == 0 )
+ Init() ;
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-
- if(phosNotFound){
- digitsBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp("PHOS",digitsBranch->GetName())==0 ) &&
- (fDigitsTitle.CompareTo(digitsBranch->GetTitle()) == 0) )
- phosNotFound = kFALSE ;
- }
- if(digitizerNotFound){
- digitizerBranch = (TBranch *) branches->At(ibranch) ;
- if( (strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) &&
- (fDigitsTitle.CompareTo(digitizerBranch->GetTitle()) == 0))
- digitizerNotFound = kFALSE ;
- }
+ if (strstr(option,"print")) {
+ Print("");
+ return ;
}
-
- if(!(digitizerNotFound && phosNotFound)){
- cout << "AliPHOSDigitizer error: " << endl ;
- cout << " can not update/overwrite existing branches "<< endl ;
- cout << " do not write " << endl ;
- return ;
- }
-
- // create new branches
+ if(strstr(option,"tim"))
+ gBenchmark->Start("PHOSDigitizer");
- //First generate file name
- char * file =0;
- if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
- file = new char[strlen(gAlice->GetBaseFile())+20] ;
- sprintf(file,"%s/PHOS.Digits.root",gAlice->GetBaseFile()) ;
- }
+ //Check, if this branch already exits
+ TObjArray * lob = (TObjArray*)gAlice->TreeD()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
- TDirectory *cwd = gDirectory;
-
- //First create list of sdigits
- Int_t bufferSize = 32000 ;
- digitsBranch = gAlice->TreeD()->Branch("PHOS",&fDigits,bufferSize);
- digitsBranch->SetTitle(fDigitsTitle.Data());
- if (file) {
- digitsBranch->SetFile(file);
- TIter next( digitsBranch->GetListOfBranches());
- TBranch * sbr ;
- while ((sbr=(TBranch*)next())) {
- sbr->SetFile(file);
- }
- cwd->cd();
- }
+ while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+ phosfound = kTRUE ;
- //second - create Digitizer
- Int_t splitlevel = 0 ;
- AliPHOSDigitizer * d = this ;
- digitizerBranch = gAlice->TreeD()->Branch("AliPHOSDigitizer","AliPHOSDigitizer",
- &d,bufferSize,splitlevel);
- digitizerBranch->SetTitle(fDigitsTitle.Data());
- if (file) {
- digitizerBranch->SetFile(file);
- TIter next( digitizerBranch->GetListOfBranches());
- TBranch * sbr;
- while ((sbr=(TBranch*)next())) {
- sbr->SetFile(file);
- }
- cwd->cd();
+ else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+ digitizerfound = kTRUE ;
}
- digitsBranch->Fill() ;
- digitizerBranch->Fill() ;
+ if ( phosfound || digitizerfound ) {
+ cerr << "WARNING: AliPHOSDigitizer::WriteDigits -> Digits and/or Digitizer branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
- gAlice->TreeD()->Write(0,kOverwrite) ;
-
- //remove fSDigitizer before new event.
- if(fSDigitizer){
- delete fSDigitizer ;
- fSDigitizer = 0 ;
- }
+ Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t ievent ;
+ for(ievent = 0; ievent < nevents; ievent++){
-}
-
-//____________________________________________________________________________
-void AliPHOSDigitizer::Exec(Option_t *option)
-{
- // Managing method
-
- if(!fInitialized) Init() ;
-
- if(strstr(option,"tim"))
- gBenchmark->Start("PHOSDigitizer");
-
- //reset events numbers to start from the beginnig
- Reset() ;
-
- while(Combinator()){
-
- if(!ReadSDigits()) //read sdigits event(s) evaluated by Combinator() from file(s)
+ if(!ReadSDigits(ievent)) //read sdigits event(s) evaluated by Combinator() from file(s)
return ;
- Digitize(option) ; //Add prepared SDigits to digits and add the noise
- WriteDigits() ;
+ Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
- if(strstr(option,"deb"))
- PrintDigits(option);
-
+ WriteDigits(ievent) ;
}
+
+ if(strstr(option,"deb"))
+ PrintDigits(option);
+
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSDigitizer");
cout << "AliPHOSDigitizer:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds for SDigitizing "
- << gBenchmark->GetCpuTime("PHOSDigitizer")/(fIeventMax->At(0)) << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds per event " << endl ;
+ // << gBenchmark->GetCpuTime("PHOSDigitizer")/(fIeventMax->At(0)) << " seconds per event " << endl ;
cout << endl ;
}
}
-//__________________________________________________________________
-Bool_t AliPHOSDigitizer::ReadSDigits()
+//____________________________________________________________________________
+void AliPHOSDigitizer::Init()
{
- // Reads summable digits from the opened files for the particular set of events given by fIevent
-
- if(!fInitialized) Init() ;
-
-
- Int_t inputs ;
- for(inputs = fNinputs-1; inputs >= 0; inputs --){
-
- Int_t event = fIevent->At(inputs) ;
-
- TFile * file = (TFile*) gROOT->GetFile(((TObjString *) fHeaderFiles->At(inputs))->GetString() ) ;
- file->cd() ;
-
- // Get SDigits Tree header from file
- char treeName[20];
- sprintf(treeName,"TreeS%d",event);
- TTree * treeS = (TTree*)file->Get(treeName);
-
- if(treeS==0){
- cout << "Error at AliPHOSDigitizer: no "<<treeName << " in file " << file->GetName() << endl ;
- cout << "Do nothing " << endl ;
- return kFALSE ;
- }
-
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
-
- TObjArray * branches = treeS->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t sdigitizerNotFound = kTRUE ;
-
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-
- if(phosNotFound){
- sdigitsBranch=(TBranch *) branches->At(ibranch) ;
- if(( strcmp("PHOS",sdigitsBranch->GetName())==0 ) &&
- ((TObjString*) fSDigitsTitles->At(inputs))->GetString().CompareTo(sdigitsBranch->GetTitle())== 0 )
- phosNotFound = kFALSE ;
-
- }
-
- if(sdigitizerNotFound){
- sdigitizerBranch = (TBranch *) branches->At(ibranch) ;
- if(( strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0) &&
- ((TObjString*) fSDigitsTitles->At(inputs))->GetString().CompareTo(sdigitizerBranch->GetTitle())== 0 )
- sdigitizerNotFound = kFALSE ;
-
- }
- }
-
- if(sdigitizerNotFound || phosNotFound){
- cout << "Can't find Branch with sdigits or SDigitizer in the file " ;
- if( ((TObjString*)fSDigitsTitles->At(inputs))->GetString().IsNull() )
- cout << file->GetName() << endl ;
- else
- cout << ((TObjString*)fSDigitsTitles->At(inputs))->GetString().Data() << endl ;
- cout << "Do nothing" <<endl ;
- return kFALSE ;
- }
-
- TClonesArray * sdigits = (TClonesArray*) fSDigits->At(inputs) ;
- sdigitsBranch->SetAddress(&sdigits) ;
-
- AliPHOSSDigitizer *sDigitizer = new AliPHOSSDigitizer();
- sdigitizerBranch->SetAddress(&sDigitizer) ;
-
- sdigitsBranch->GetEntry(0) ;
- sdigitizerBranch->GetEntry(0) ;
+ // Makes all memory allocations
+ // Adds Digitizer task to the folder of PHOS tasks
+ //============================================================= YS
+ // The initialisation is now done by AliPHOSGetter
- if(fSDigitizer == 0)
- fSDigitizer = sDigitizer ;
- else
- if(!((*fSDigitizer)==(*sDigitizer)) ){
- cout << "AliPHOSDigitizer ERROR:" << endl ;
- cout << " you are using sdigits made with different SDigitizers" << endl ;
- cout << "fSD " << fSDigitizer << " SD" << sDigitizer << endl ;
- fSDigitizer->Print("") ;
- sDigitizer->Print("") ;
- cout << "Do Nothing " << endl ;
- return kFALSE ;
- }
+ if( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+
+ // the SDigits name is stored by AliPHOSGetter as the name of the TClones Array
+ // //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/branchname and has branchTitle as title.
- }
- fPedestal = fSDigitizer->GetPedestalParameter() ;
- fSlope = fSDigitizer->GetCalibrationParameter() ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ return ;
+ }
+
+// fIevent = new TArrayI(1) ;
+// fIevent->AddAt(-1,0 ) ;
+// fIeventMax = new TArrayI(1) ;
- return kTRUE ;
+// fIeventMax->AddAt((Int_t) gAlice->TreeE()->GetEntries(), 0 );
+
+ //add Task to //YSAlice/tasks/Digitizer/PHOS
+ TTask * aliceSD = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Digitizer") ;
+ TTask * phosSD = (TTask*)aliceSD->GetListOfTasks()->FindObject("PHOS") ;
+ phosSD->Add(this) ;
+ // create a folder on the white board //YSAlice/WhiteBoard/Digits/PHOS/headerFile/digitsTitle
+ gime->Post(GetTitle(), "D", GetName() ) ;
}
+
//__________________________________________________________________
-void AliPHOSDigitizer::MixWith(char* HeaderFile, char* sDigitsTitle)
+void AliPHOSDigitizer::MixWith(const char* headerFile)
{
// Alows to produce digits by superimposing background and signal event.
// It is assumed, that headers file with SIGNAL events is opened in
// opened in constructor file.
//
// One can open as many files to mix with as one needs.
+ // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
+ // can be mixed.
-
- if(!fInitialized)
+ if( strcmp(GetName(), "") == 0 )
Init() ;
+ const char* sDigitsTitle = GetName() ;
+
+ // check if the specified SDigits do not already exist on the White Board:
+ // //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/sDigitsTitle
- if(HeaderFile == 0){
- cout << "Specify at least header file to merge"<< endl ;
- return ;
+ TString path = "YSAlice/WhiteBoard/SDigits/PHOS/" ;
+ path += headerFile ;
+ path += "/" ;
+ path += sDigitsTitle ;
+ if ( gROOT->FindObjectAny(path.Data()) ) {
+ cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
+ return;
}
-
- Int_t inputs ;
- for(inputs = 0; inputs < fNinputs ; inputs++){
- if(strcmp(((TObjString *)fHeaderFiles->At(inputs))->GetString(),HeaderFile) == 0 ){
- if(sDigitsTitle == 0){
- if(((TObjString*)fSDigitsTitles->At(inputs))->GetString().CompareTo("") == 0){
- cout << "Entry already exists, do not add" << endl ;
- return ;
- }
+ // check if the requested file is already open or exist and if SDigits Branch exist
+ TFile * file = (TFile*)gROOT->FindObject(headerFile);
+ if ( !file ) {
+ file = new TFile(headerFile, "READ") ;
+ if (!file) {
+ cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
+ return ;
+ }
+ }
+ Int_t nevent = (Int_t)((TTree*)file->Get("TE"))->GetEntries() ;
+ Int_t ievent ;
+ for (ievent = 0; ievent < nevent; ievent++) {
+ TString tsname("TreeS") ;
+ tsname += ievent ;
+ TTree * ts = (TTree*)file->Get(tsname.Data()) ;
+ if ( !ts ) {
+ cerr << "ERROR: AliPHOSDigitizer::MixWith -> TreeS0 " << " does not exist in " << headerFile << endl ;
+ return ;
+ }
+
+ TObjArray * lob = (TObjArray*)ts->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ TBranch * sdigitsbranch = 0 ;
+ TBranch * sdigitizerbranch = 0 ;
+ Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
+
+ while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), sDigitsTitle)==0) ) {
+ sdigitsbranch = branch ;
+ phosfound = kTRUE ;
}
- else
- if(((TObjString*)fSDigitsTitles->At(inputs))->GetString().CompareTo(sDigitsTitle)){
- cout << "Entry already exists, do not add" << endl ;
- return;
- }
- }
- }
-
- fHeaderFiles->Expand(fNinputs+1) ;
- new((*fHeaderFiles)[fNinputs]) TObjString(HeaderFile) ;
-
-
- TFile * file = new TFile(((TObjString *) fHeaderFiles->At(fNinputs))->GetString()) ;
-
- file->cd() ;
-
- fSDigitsTitles->Expand(fNinputs+1) ;
- new((*fSDigitsTitles)[fNinputs]) TObjString(sDigitsTitle) ;
-
- fSDigits->Expand(fNinputs+1) ;
- new((*fSDigits)[fNinputs]) TClonesArray("AliPHOSDigit",1000) ;
-
- fIevent->Set(fNinputs+1) ;
- fIevent->AddAt(-1, fNinputs) ;
-
- fIeventMax->Set(fNinputs+1) ;
-
- TTree * te = (TTree *) file->Get("TE") ;
- fIeventMax->AddAt((Int_t) te->GetEntries(), fNinputs );
-
- fNinputs++ ;
-
+ else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), sDigitsTitle)==0) ) {
+ sdigitizerbranch = branch ;
+ sdigitizerfound = kTRUE ;
+ }
+ }
+
+ if ( !phosfound || !sdigitizerfound ) {
+ cerr << "WARNING: AliPHOSDigitizer::MixWith -> Cannot find SDigits and/or SDigitizer with name " << sDigitsTitle << endl ;
+ return ;
+ }
+
+ // post the new SDigits to the White Board
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ gime->Post(headerFile, "S", sDigitsTitle, ievent ) ;
+ TClonesArray * sdigits = gime->SDigits(sDigitsTitle, headerFile) ;
+ sdigitsbranch->SetAddress(&sdigits) ;
+ sdigitsbranch->GetEvent(0) ;
+ }
}
+
//__________________________________________________________________
void AliPHOSDigitizer::Print(Option_t* option)const {
// Print Digitizer's parameters
- if(fInitialized){
+ if( strcmp(GetName(), "") != 0 ){
cout << "------------------- "<< GetName() << " -------------" << endl ;
cout << "Digitizing sDigits from file(s): " <<endl ;
- Int_t input ;
- for(input = 0; input < fNinputs ; input++) {
- cout << " " << ((TObjString *) fHeaderFiles->At(input))->GetString() <<
- " Branch title:" << ((TObjString *) fSDigitsTitles->At(input))->GetString() << endl ;
+
+ TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS"))->GetListOfFolders() ;
+ TIter next(folderslist) ;
+ TFolder * folder = 0 ;
+
+ while ( (folder = (TFolder*)next()) ) {
+ if ( folder->FindObject(GetName()) )
+ cout << "Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
}
cout << endl ;
- cout << "Writing digits to " << ((TObjString *) fHeaderFiles->At(0))->GetString() << endl ;
+ cout << "Writing digits to " << GetTitle() << endl ;
cout << endl ;
cout << "With following parameters: " << endl ;
void AliPHOSDigitizer::PrintDigits(Option_t * option){
// Print a table of digits
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * digits = gime->Digits() ;
+
cout << "AliPHOSDigitiser:"<< endl ;
- cout << " Number of entries in Digits list " << fDigits->GetEntriesFast() << endl ;
+ cout << " Number of entries in Digits list " << digits->GetEntriesFast() << endl ;
cout << endl ;
if(strstr(option,"all")){
AliPHOSDigit * digit;
cout << "Digit Id " << " Amplitude " << " Index " << " Nprim " << " Primaries list " << endl;
Int_t index ;
- for (index = 0 ; index < fDigits->GetEntries() ; index++) {
- digit = (AliPHOSDigit * ) fDigits->At(index) ;
+ for (index = 0 ; index < digits->GetEntries() ; index++) {
+ digit = (AliPHOSDigit * ) digits->At(index) ;
cout << setw(8) << digit->GetId() << " " << setw(3) << digit->GetAmp() << " "
<< setw(6) << digit->GetIndexInList() << " "
<< setw(5) << digit->GetNprimary() <<" ";
}
}
+
//__________________________________________________________________
void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
{
// we set title (comment) of the SDigits branch in the first! header file
- if(!fInitialized) Init() ;
-
- ((TObjString*) fSDigitsTitles->At(0) )->SetString((char*)title) ;
+ if( strcmp(GetName(), "") == 0 )
+ Init() ;
+ AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
+
}
+
//__________________________________________________________________
-void AliPHOSDigitizer::SetDigitsBranch(const char* title)
+Bool_t AliPHOSDigitizer::ReadSDigits(Int_t event)
{
- //Sets the title (comment) of the branch to which Digits branch
- if(!fInitialized) Init() ;
+ // Reads summable digits from the opened files for the particular set of events given by fIevent
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- fDigitsTitle = title ;
+ TFile * file = (TFile*)gROOT->GetFile(GetTitle());
+ file->cd() ;
-}
-//__________________________________________________________________
+// Get SDigits Tree header from file
+ TString treeName("TreeS") ;
+ treeName += event ;
+ TTree * treeS = (TTree*)file->Get(treeName.Data());
+
+ if(treeS==0){
+ cerr << "ERROR: AliPHOSDigitizer::ReadSDigits There is no SDigit Tree" << endl;
+ return kFALSE;
+ }
+
+ //set address of the SDigits and SDigitizer
+ TBranch * sdigitsBranch = 0;
+ TBranch * sdigitizerBranch = 0;
+ TObjArray * lob = (TObjArray*)gAlice->TreeS()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
+
+ while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), GetName())==0) ) {
+ phosfound = kTRUE ;
+ sdigitsBranch = branch ;
+ }
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) ) {
+ sdigitizerfound = kTRUE ;
+ sdigitizerBranch = branch ;
+ }
+ }
+ if ( !phosfound || !sdigitizerfound ) {
+ cerr << "WARNING: AliPHOSDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
+
+
+ TClonesArray * sdigits = gime->SDigits() ;
+ sdigitsBranch->SetAddress(&sdigits) ;
+
+ AliPHOSSDigitizer * sdigitizer = gime->SDigitizer() ;
+ sdigitizerBranch->SetAddress(&sdigitizer) ;
+
+ sdigitsBranch->GetEntry(0) ;
+ sdigitizerBranch->GetEntry(0) ;
+ fPedestal = sdigitizer->GetPedestalParameter() ;
+ fSlope = sdigitizer->GetCalibrationParameter() ;
+
+ return kTRUE ;
+
+}
+
+//____________________________________________________________________________
+void AliPHOSDigitizer::Reset()
+{
+ // sets current event number to the first simulated event
+
+ if( strcmp(GetName(), "") == 0 )
+ Init() ;
+
+ // Int_t inputs ;
+// for(inputs = 0; inputs < fNinputs ;inputs++)
+// fIevent->AddAt(-1, inputs ) ;
+
+}
+
+//____________________________________________________________________________
+void AliPHOSDigitizer::WriteDigits(Int_t event)
+{
+
+ // Makes TreeD in the output file.
+ // Check if branch already exists:
+ // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
+ // already existing branches.
+ // else creates branch with Digits, named "PHOS", title "...",
+ // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
+ // and names of files, from which digits are made.
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * digits = gime->Digits() ;
+
+
+ gAlice->GetEvent(event) ;
+ if(gAlice->TreeD()==0)
+ gAlice->MakeTree("D") ;
+
+ // create new branches
+ // -- generate file name if necessary
+ char * file =0;
+ if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
+ file = new char[strlen(gAlice->GetBaseFile())+20] ;
+ sprintf(file,"%s/PHOS.Digits.root",gAlice->GetBaseFile()) ;
+ }
+
+ TDirectory *cwd = gDirectory;
+
+ // -- create Digits branch
+ Int_t bufferSize = 32000 ;
+ TBranch * digitsBranch = gAlice->TreeD()->Branch("PHOS",&digits,bufferSize);
+ digitsBranch->SetTitle(GetName());
+ if (file) {
+ digitsBranch->SetFile(file);
+ TIter next( digitsBranch->GetListOfBranches());
+ TBranch * sbr ;
+ while ((sbr=(TBranch*)next())) {
+ sbr->SetFile(file);
+ }
+ cwd->cd();
+ }
+
+ // -- Create Digitizer branch
+ Int_t splitlevel = 0 ;
+ AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
+ TBranch * digitizerBranch = gAlice->TreeD()->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
+ digitizerBranch->SetTitle(GetName());
+ if (file) {
+ digitizerBranch->SetFile(file);
+ TIter next( digitizerBranch->GetListOfBranches());
+ TBranch * sbr;
+ while ((sbr=(TBranch*)next())) {
+ sbr->SetFile(file);
+ }
+ cwd->cd();
+ }
+
+
+ digitsBranch->Fill() ;
+ digitizerBranch->Fill() ;
+
+ gAlice->TreeD()->Write(0,kOverwrite) ;
+
+}
+
+
public:
AliPHOSDigitizer() ; // ctor
- AliPHOSDigitizer(const char *headerFile,const char * sDigitsBranchTitle = 0) ;
+ AliPHOSDigitizer(const char *headerFile, const char * name = "No Name") ;
AliPHOSDigitizer(const AliPHOSDigitizer & dtizer) {( (AliPHOSDigitizer &)dtizer ).Copy(*this) ;} // cpy ctor
virtual ~AliPHOSDigitizer() ;
- void Digitize(Option_t *option); // Make Digits from SDigits stored in fSDigits
+ void Digitize(const Int_t event) ; // Make Digits from SDigits
void Exec(Option_t *option); // Supervising method
- Float_t GetCPVNoise() const { return fCPVNoise ;}
- Float_t GetCPVThreshold() const { return fCPVDigitThreshold ;}
- Float_t GetEMCThreshold() const { return fEMCDigitThreshold;}
- Float_t GetPedestal() const { return fPedestal; }
- Float_t GetPinNoise() const { return fPinNoise;}
- Float_t GetPPSDNoise() const { return fPPSDNoise ;}
- Float_t GetPPSDThreshold()const { return fPPSDDigitThreshold ;}
- Float_t GetSlope() const { return fSlope; }
- char * GetDigitsBranch ()const { return (char*)fDigitsTitle.Data() ;}
- char * GetSDigitsBranch()const { return (char*)((TObjString*)fSDigitsTitles->At(0))->GetString().Data() ;}
- TClonesArray * GetHeadersFiles() const { return fHeaderFiles ;}
- TArrayI * GetCurrentEvents()const { return fIevent ;}
-
- void MixWith(char* HeaderFile, char* SDigitsTitle =0) ; // Add another one file to mix
+ const Float_t GetCPVNoise() const { return fCPVNoise ;}
+ const Float_t GetCPVThreshold() const { return fCPVDigitThreshold ;}
+ const Float_t GetEMCThreshold() const { return fEMCDigitThreshold;}
+ const Float_t GetPedestal() const { return fPedestal; }
+ const Float_t GetPinNoise() const { return fPinNoise;}
+ const Float_t GetPPSDNoise() const { return fPPSDNoise ;}
+ const Float_t GetPPSDThreshold()const { return fPPSDDigitThreshold ;}
+ const Float_t GetSlope() const { return fSlope; }
+ // const TArrayI * GetCurrentEvents()const { return fIevent ;}
+
+ void MixWith(const char* HeaderFile) ; // Add another one file to mix
virtual void Print(Option_t* option)const ;
void Reset() ; //restarts starts event processing from 0 event(s)
void SetPPSDNoise(Float_t PPSDNoise) {fPPSDNoise = PPSDNoise;}
void SetPPSDThreshold(Float_t PPSDThreshold){fPPSDDigitThreshold = PPSDThreshold;}
- void SetDigitsBranch (const char* file) ;
void SetSDigitsBranch(const char* file) ;
AliPHOSDigitizer & operator = (const AliPHOSDigitizer & rvalue) {
}
private:
- Bool_t Combinator() ; // makes all desirable combination sig+Bg
- void Init();
- Bool_t ReadSDigits() ; // Read sdigits for particular events
- void WriteDigits() ; // Writes Digits for particular event
+ void Init() ;
void PrintDigits(Option_t * option) ;
+ Bool_t ReadSDigits(Int_t evt) ; // Read sdigits for particular events
+ void WriteDigits(Int_t evt) ; // Writes Digits for particular event
private:
- TClonesArray * fSDigitsTitles ; // Titles of sdigits branches
- TClonesArray * fHeaderFiles ; // Names of files with headers to merge
- TString fDigitsTitle ; // Title of the Digits Branch
- TClonesArray * fSDigits ; // ! Lists of SDigits
- TClonesArray * fDigits ; // ! Final list of digits
- AliPHOSSDigitizer * fSDigitizer ; // ! SDigitizer to extarct some sdigitizing parameters
- Int_t fNinputs ; // Number of input files
- Bool_t fInitialized ; // kTRUE if AliPHOSDigitizer is initialized
- TArrayI * fIevent ; // events to read at the next ReadSDigits() call
- TArrayI * fIeventMax ; // Maximal number of events in each input file
Float_t fPedestal ; // Calibration parameters
Float_t fSlope ; // read from SDigitizer
#include "AliPHOSGeometry.h"
#include "AliPHOSEmcRecPoint.h"
#include "AliRun.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSEmcRecPoint)
fAmp = 0. ;
fCoreEnergy = 0 ;
fEnergyList = 0 ;
- fGeom = AliPHOSGeometry::GetInstance() ;
fLocPos.SetX(1000000.) ; //Local position should be evaluated
-
+
}
//____________________________________________________________________________
Bool_t aren = kFALSE ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
+
Int_t relid1[4] ;
phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
{
// Commented by Dmitri Peressounko: there is no possibility to ensure,
-// that AliPHOSIndexToObject keeps the correct information.
+// that AliPHOSGetter keeps the correct information.
// // Execute action corresponding to one event
// // This member function is called when a AliPHOSRecPoint is clicked with the locator
// // static Int_t pxold, pyold;
-// AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
// static TGraph * digitgraph = 0 ;
// case kButton1Down: {
// AliPHOSDigit * digit ;
-// AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
// Int_t iDigit;
// Int_t relid[4] ;
// Float_t zimin = 999. ;
// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
-// digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ;
+// digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
// phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
// phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
// if ( xi[iDigit] > ximax )
// Float_t x, z ;
// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
-// digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) ) ;
+// digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
// phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
// phosgeom->RelPosInModule(relid, x, z);
// histo->Fill(x, z, fEnergyList[iDigit] ) ;
Float_t z = locpos.Z() ;
AliPHOSDigit * digit ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
Int_t iDigit;
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
Float_t z = locpos.Z() ;
AliPHOSDigit * digit ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
-
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
+
Int_t iDigit;
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
Double_t dxz = 0.;
AliPHOSDigit * digit ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
+
Int_t iDigit;
for(iDigit=0; iDigit<fMulDigit; iDigit++) {
// //Apply correction due to non-perpendicular incidence
// Double_t CosX ;
// Double_t CosZ ;
-// Double_t DistanceToIP= (Double_t ) ((AliPHOSGeometry *) fGeom)->GetIPtoCrystalSurface() ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
+ // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ;
// CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
// CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ;
AliPHOSDigit * digit ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
Int_t iDigit;
return fIndexInList ;
}
Int_t GetPrimary(){return fPrimary;}
- Int_t GetType() {
+ const Int_t GetType() const {
// returns the type of the particle
return fType ;
}
fRotMatrixArray = new TObjArray(fNModules) ;
// post the geometry into the appropriate folder
- // get the alice folder
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- // the folder that contains the alarms for PHOS
- TFolder * folder = (TFolder*)alice->FindObject("folders/Geometry/PHOS");
+ TFolder * folder = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/Geometry/PHOS");
+ if ( !folder ) {
+ cerr << "ERROR: AliPHOSGeometry::Init -> No WhiteBoard/Geometry/PHOS found !" << endl ;
+ abort();
+ } else {
folder->SetOwner() ;
folder->Add(this) ;
+ }
}
else {
fgInit = kFALSE ;
}
//____________________________________________________________________________
-Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid)
+Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid) const
{
// Converts the absolute numbering into the following array/
// relid[0] = PHOS Module number 1:fNModules
}
//____________________________________________________________________________
-void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt)
+void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) const
{
// calculates the angular coverage in theta and phi of one EMC (=PHOS) module
}
//____________________________________________________________________________
-void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt)
+void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) const
{
// calculates the angular coverage in theta and phi of a single crystal in a EMC(=PHOS) module
}
//____________________________________________________________________________
-void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x)
+void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const
{
// calculates the impact coordinates on PHOS of a neutral particle
// emitted in the direction theta and phi in the ALICE global coordinate system
}
//____________________________________________________________________________
-Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId)
+Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) const
{
// Converts the relative numbering into the absolute numbering
// EMCA crystals:
//____________________________________________________________________________
-void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos )
+void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) const
{
// Converts the absolute numbering into the global ALICE coordinate system
// It works only for the GPS2 geometry
}
//____________________________________________________________________________
-void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z)
+void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z) const
{
// Converts the relative numbering into the local PHOS-module (x, z) coordinates
// Note: sign of z differs from that in the previous version (Yu.Kharlov, 12 Oct 2000)
return TString("rad") ;
}
- Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative
+ Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) const ; // converts the absolute PHOS numbering to a relative
- void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() );
+ void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() ) const ;
// calculates the angular coverage in theta and phi of a EMC module
- void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) ;
+ void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ;
// calculates the angular coverage in theta and phi of a
// single crystal in a EMC module
- void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) ;
+ void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
// calculates the impact coordinates of a neutral particle
// emitted in direction theta and phi in ALICE
- void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) ; // gets the position of element (pad or Xtal) relative to
+ void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ; // gets the position of element (pad or Xtal) relative to
// center of PHOS module
- void RelPosInAlice(const Int_t AbsId, TVector3 & pos) ; // gets the position of element (pad or Xtal) relative to
+ void RelPosInAlice(const Int_t AbsId, TVector3 & pos) const ; // gets the position of element (pad or Xtal) relative to
// Alice
- Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) ; // converts the absolute PHOS numbering to a relative
+ Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ; // converts the absolute PHOS numbering to a relative
Bool_t IsInitialized(void) const { return fgInit ; }
ClassImp(AliPHOSPID)
//____________________________________________________________________________
- AliPHOSPID::AliPHOSPID():TTask()
+ AliPHOSPID::AliPHOSPID():TTask("","")
{
// ctor
}
+
//____________________________________________________________________________
-AliPHOSPID::AliPHOSPID(const char* header,const char * branch ):TTask()
+AliPHOSPID::AliPHOSPID(const char* headerFile, const char * name ):TTask(name, headerFile)
{
// ctor
- cout << "AliPHOSPID: This constructor should be overwritten! "<< endl ;
- abort() ;
-
}
+
//____________________________________________________________________________
AliPHOSPID::~AliPHOSPID()
{
public:
AliPHOSPID() ; // ctor
- AliPHOSPID(const char* headerFile,const char * tsBranch) ;
+ AliPHOSPID(const char* headerFile,const char * name) ;
virtual ~AliPHOSPID() ; // dtor
virtual void Exec(Option_t * option) = 0 ;
virtual char * GetRecParticlesBranch()const = 0 ;
virtual char * GetTrackSegmentsBranch()const = 0 ;
virtual void Init()= 0 ;
-
virtual void Print(Option_t * option) const = 0 ;
virtual void PlotDispersionCuts()const = 0;
- virtual Bool_t ReadTrackSegments()= 0 ;
-
+ virtual Bool_t ReadTrackSegments(Int_t event)= 0 ;
virtual void SetIdentificationMethod(char * option) = 0 ;
-
virtual void SetShowerProfileCut(char * formula) = 0 ;
virtual void SetDispersionCut(Float_t cut) = 0 ;
virtual void SetCpvtoEmcDistanceCut(Float_t cut ) = 0;
-
virtual void SetTrackSegmentsBranch(const char* title) = 0 ;
virtual void SetRecParticlesBranch (const char* title) = 0 ;
-
- virtual void WriteRecParticles()= 0 ;
+ virtual const char * Version() const = 0 ;
+ virtual void WriteRecParticles(Int_t event)= 0 ;
protected:
#include "AliPHOSTrackSegment.h"
#include "AliPHOSTrackSegmentMakerv1.h"
#include "AliPHOSRecParticle.h"
+#include "AliPHOSGeometry.h"
+#include "AliPHOSGetter.h"
ClassImp( AliPHOSPIDv1)
AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID()
{
// default ctor
- fIsInitialized = kFALSE ;
+ fFormula = 0 ;
+ fDispersion = 0. ;
+ fCpvEmcDistance = 0 ;
+ fHeaderFileName = "" ;
+ fTrackSegmentsTitle= "" ;
+ fRecPointsTitle = "" ;
+ fRecParticlesTitle = "" ;
+ fIDOptions = "" ;
}
//____________________________________________________________________________
-AliPHOSPIDv1::AliPHOSPIDv1(const char * headeFile,const char * tsBranchTitle):AliPHOSPID()
+AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name) : AliPHOSPID(headerFile, name)
{
//ctor with the indication on where to look for the track segments
- fHeaderFileName = headeFile ;
-
- fTSTitle = tsBranchTitle ;
-
- SetName("AliPHOSPID") ;
- SetTitle("version1") ;
- fIsInitialized = kFALSE ;
-
+ fFormula = new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)") ;
+ fDispersion = 2.0 ;
+ fCpvEmcDistance = 3.0 ;
+
+ fHeaderFileName = GetTitle() ;
+ fTrackSegmentsTitle = GetName() ;
+ fRecPointsTitle = GetName() ;
+ fRecParticlesTitle = GetName() ;
+ fIDOptions = "" ;
+
+ TString tempo(GetName()) ;
+ tempo.Append(Version()) ;
+ SetName(tempo.Data()) ;
+
Init() ;
}
+
//____________________________________________________________________________
AliPHOSPIDv1::~AliPHOSPIDv1()
{
//dtor
}
-//____________________________________________________________________________
-void AliPHOSPIDv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
- // Add the PID task to the list of PHOS tasks
- if(!fIsInitialized){
- if(fHeaderFileName.IsNull())
- fHeaderFileName = "galice.root" ;
-
- TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data() ) ;
-
- if(file == 0){
- if(fHeaderFileName.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFileName.Data(),"update") ;
- else
- file = new TFile(fHeaderFileName.Data(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ;
- }
-
- AliPHOS * phos = (AliPHOS *) gAlice->GetDetector("PHOS") ;
- fGeom = AliPHOSGeometry::GetInstance(phos->GetGeometry()->GetName(),phos->GetGeometry()->GetTitle() );
-
- fTrackSegments = new TClonesArray("AliPHOSTrackSegment",1) ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1() ;
- fEmcRecPoints = new TObjArray(1) ;
- fCpvRecPoints = new TObjArray(1) ;
- fClusterizer = new AliPHOSClusterizerv1() ;
- fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ;
-
- fFormula = new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)") ;
-
- fDispersion = 2.0 ;
- fCpvEmcDistance = 3.0 ;
-
- //add Task to //YSAlice/tasks/Reconstructioner/PHOS
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceRe = (TTask*)alice->FindObject("tasks/Reconstructioner") ;
- TTask * phosRe = (TTask*)aliceRe->GetListOfTasks()->FindObject("PHOS") ;
- phosRe->Add(this) ;
-
- fIsInitialized = kTRUE ;
- }
-}
//____________________________________________________________________________
-Bool_t AliPHOSPIDv1::ReadTrackSegments()
+Bool_t AliPHOSPIDv1::ReadTrackSegments(Int_t event)
{
// Reads TrackSegments an extracts the title of the RecPoints
// branch from which TS were made of.
// Then reads both TrackSegments and RecPoints.
//Fist read Track Segment Branch and extract RecPointsBranch from fTSMaker
- fTrackSegments->Clear() ;
- fEmcRecPoints->Clear() ;
- fCpvRecPoints->Clear() ;
- fRecParticles->Clear() ;
- gAlice->GetEvent(fNEvent) ;
+ gAlice->GetEvent(event) ;
+ gAlice->SetEvent(event) ;
- TTree * treeR = gAlice->TreeR() ;
-
- if(treeR==0){
- char treeName[20];
- sprintf(treeName,"TreeR%d",fNEvent);
- cout << "Error in AliPHOSClusterizerv1 : no "<<treeName << endl ;
- cout << " Do nothing " << endl ;
- return kFALSE ;
+ // Get TreeR header from file
+ if(gAlice->TreeR()==0){
+ cerr << "ERROR: AliPHOSPIDv1::ReadTrackSegments -> There is no Reconstruction Tree" << endl;
+ return kFALSE;
}
+
+ // Find TrackSegments
+ TBranch * tsbranch = 0;
+ TBranch * tsmakerbranch = 0;
+ TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ;
+
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
- //first read TSMaker branch and extract information about RecPoints Branches
- TBranch * tsMakerBranch = 0;
- TBranch * tsBranch = 0;
-
- TObjArray * branches = treeR->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t tsMakerNotFound = kTRUE ;
- Bool_t tsNotFound = kTRUE ;
+ while ( (branch = (TBranch*)next()) && (!phostsfound || !tsmakerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phostsfound = kTRUE ;
+ tsbranch = branch ;
- for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
- if(tsMakerNotFound){
- tsMakerBranch=(TBranch *) branches->At(ibranch) ;
- if( fTSTitle.CompareTo(tsMakerBranch->GetTitle())==0 )
- if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
- tsMakerNotFound = kFALSE ;
- }
- if(tsNotFound){
- tsBranch=(TBranch *) branches->At(ibranch) ;
- if( fTSTitle.CompareTo(tsBranch->GetTitle())==0 )
- if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
- tsNotFound = kFALSE ;
+ } else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ tsmakerfound = kTRUE ;
+ tsmakerbranch = branch ;
}
}
-
- if(tsMakerNotFound ||tsNotFound ){
- cout << "Can't find Branch with TrackSegmentMaker and TrackSegments " ;
- cout << "Do nothing" <<endl ;
- return kFALSE ;
- }
-
- tsMakerBranch->SetAddress(&fTSMaker) ;
- tsBranch->SetAddress(&fTrackSegments) ;
-
- tsMakerBranch->GetEntry(0) ;
- tsBranch->GetEntry(0) ;
-
- fRecPointsTitle = fTSMaker->GetRecPointsBranch() ;
-
- //reading now recponts branches
- TBranch * emcBranch = 0;
- TBranch * cpvBranch = 0;
- TBranch * cluBranch = 0;
-
- Bool_t emcNotFound = kTRUE ;
- Bool_t cpvNotFound = kTRUE ;
- Bool_t cluNotFound = kTRUE ;
+ if ( !phostsfound || !tsmakerfound ) {
+ cerr << "WARNING: AliPHOSPIDv1::ReadTrackSegments -> TrackSegments and/or TrackSegmentMaker branch with name " << taskName.Data()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
- for(ibranch = 0;(ibranch <branches->GetEntries())&&(emcNotFound||cpvNotFound||cluNotFound);ibranch++){
- if(emcNotFound){
- emcBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(emcBranch->GetTitle())==0 )
- if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
- emcNotFound = kFALSE ;
- }
- if(cpvNotFound){
- cpvBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(cpvBranch->GetTitle())==0 )
- if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
- cpvNotFound = kFALSE ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ TClonesArray * trackSegments = gime->TrackSegments() ;
+ trackSegments->Clear() ;
+ tsbranch->SetAddress(&trackSegments) ;
+
+ AliPHOSTrackSegmentMaker * tsmaker = 0 ;
+ tsmakerbranch->SetAddress(&tsmaker) ;
+ tsmakerbranch->GetEntry(0) ;
+ TString tsmakerName( fRecParticlesTitle ) ;
+ tsmakerName.Append(tsmaker->Version()) ;
+ tsmaker = gime->TrackSegmentMaker(tsmakerName) ;
+
+ tsbranch->GetEntry(0) ;
+ tsmakerbranch->GetEntry(0) ;
+
+ fRecPointsTitle = tsmaker->GetRecPointsBranch() ;
+
+ // Find RecPoints
+ TBranch * emcbranch = 0;
+ TBranch * cpvbranch = 0;
+ TBranch * clusterizerbranch = 0;
+ lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next2(lob) ;
+ branch = 0 ;
+ Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
+
+ while ( (branch = (TBranch*)next2()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phosemcfound = kTRUE ;
+ emcbranch = branch ;
}
- if(cluNotFound){
- cluBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(cluBranch->GetTitle())==0 )
- if( strcmp(cluBranch->GetName(),"AliPHOSClusterizer") == 0)
- cluNotFound = kFALSE ;
+
+ else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phoscpvfound = kTRUE ;
+ cpvbranch = branch ;
+
+ } else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ clusterizerfound = kTRUE ;
+ clusterizerbranch = branch ;
}
}
+ if ( !phosemcfound || !phoscpvfound || !clusterizerfound ) {
+ cerr << "WARNING: AliPHOSTrackPIDv1::ReadTrackSegments -> emc(cpv)RecPoints and/or Clusterizer branch with name " << taskName.Data()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
+
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ emcRecPoints->Clear() ;
+ emcbranch->SetAddress(&emcRecPoints) ;
- if(emcNotFound ||cpvNotFound ||cluNotFound ){
- cout << "Can't find Branch with RecPoints or AliPHOSClusterizer " ;
- cout << "Do nothing" <<endl ;
- return kFALSE ;
- }
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ cpvRecPoints->Clear() ;
+ cpvbranch->SetAddress(&cpvRecPoints) ;
- emcBranch->SetAddress(&fEmcRecPoints) ;
- cpvBranch->SetAddress(&fCpvRecPoints) ;
- cluBranch->SetAddress(&fClusterizer) ;
-
- emcBranch->GetEntry(0) ;
- cpvBranch->GetEntry(0) ;
- cluBranch->GetEntry(0) ;
-
+
+ AliPHOSClusterizer * clusterizer = 0 ;
+ clusterizerbranch->SetAddress(&clusterizer) ;
+ clusterizerbranch->GetEntry(0) ;
+ TString clusterizerName( fTrackSegmentsTitle ) ;
+ clusterizerName.Append(clusterizer->Version()) ;
+ clusterizer = gime->Clusterizer(clusterizerName) ;
+
+ emcbranch->GetEntry(0) ;
+ cpvbranch->GetEntry(0) ;
+ clusterizerbranch->GetEntry(0) ;
+
return kTRUE ;
-
-
-
+
}
+
//____________________________________________________________________________
Float_t AliPHOSPIDv1::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * Axis)const
{
// Calculates the distance between the EMC RecPoint and the PPSD RecPoint
+ const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
TVector3 vecEmc ;
TVector3 vecCpv ;
// Correct to difference in CPV and EMC position due to different distance to center.
// we assume, that particle moves from center
- Float_t dCPV = fGeom->GetIPtoOuterCoverDistance();
- Float_t dEMC = fGeom->GetIPtoCrystalSurface() ;
+ Float_t dCPV = geom->GetIPtoOuterCoverDistance();
+ Float_t dEMC = geom->GetIPtoCrystalSurface() ;
dEMC = dEMC / dCPV ;
vecCpv = dEMC * vecCpv - vecEmc ;
if (Axis == "X") return vecCpv.X();
{
//Steering method
- if(!fIsInitialized)
+ if( strcmp(GetName(), "")== 0 )
Init() ;
- if(strstr(option,"tim"))
+ if(strstr(option,"tim"))
gBenchmark->Start("PHOSPID");
+
+ if(strstr(option,"print")) {
+ Print("") ;
+ return ;
+ }
+
+ //check, if the branch with name of this" already exits?
+ TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phospidfound = kFALSE, pidfound = kFALSE ;
+
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+ while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ phospidfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ pidfound = kTRUE ;
+ }
- Int_t nEvents = (Int_t) gAlice->TreeE()->GetEntries() ;
-
- for(fNEvent = 0 ;fNEvent <nEvents; fNEvent++){
- if(!ReadTrackSegments())
+ if ( phospidfound || pidfound ) {
+ cerr << "WARNING: AliPHOSPIDv1::Exec -> RecParticles and/or PIDtMaker branch with name "
+ << taskName.Data() << " already exits" << endl ;
+ return ;
+ }
+
+ Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t ievent ;
+
+ for(ievent = 0; ievent < nevents; ievent++){
+ if(!ReadTrackSegments(ievent)) //reads TrackSegments for event ievent
return ;
+
MakeRecParticles() ;
- WriteRecParticles();
+ cout << "MAKE" << endl ;
+ WriteRecParticles(ievent);
+
if(strstr(option,"deb"))
PrintRecParticles(option) ;
}
gBenchmark->Stop("PHOSPID");
cout << "AliPHOSPID:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("PHOSPID") << " seconds for PID "
- << gBenchmark->GetCpuTime("PHOSPID")/nEvents << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("PHOSPID")/nevents << " seconds per event " << endl ;
cout << endl ;
}
}
+//____________________________________________________________________________
+void AliPHOSPIDv1::Init()
+{
+ // Make all memory allocations that are not possible in default constructor
+ // Add the PID task to the list of PHOS tasks
+
+ if ( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliPHOSPIDv1::Init -> Could not obtain the Getter object !" << endl ;
+ return ;
+ }
+
+ //add Task to //YSAlice/tasks/Reconstructioner/PHOS
+ TTask * aliceRe = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Reconstructioner") ;
+ TTask * phosRe = (TTask*)aliceRe->GetListOfTasks()->FindObject("PHOS") ;
+ phosRe->Add(this) ;
+ // create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName
+ gime->Post(GetTitle(), "P", taskName.Data() ) ;
+
+}
+
//____________________________________________________________________________
void AliPHOSPIDv1::MakeRecParticles(){
// Makes a RecParticle out of a TrackSegment
- TIter next(fTrackSegments) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ TClonesArray * trackSegments = gime->TrackSegments() ;
+ TClonesArray * recParticles = gime->RecParticles() ;
+
+ TIter next(trackSegments) ;
AliPHOSTrackSegment * ts ;
Int_t index = 0 ;
AliPHOSRecParticle * rp ;
while ( (ts = (AliPHOSTrackSegment *)next()) ) {
- new( (*fRecParticles)[index] ) AliPHOSRecParticle() ;
- rp = (AliPHOSRecParticle *)fRecParticles->At(index) ;
+ new( (*recParticles)[index] ) AliPHOSRecParticle() ;
+ rp = (AliPHOSRecParticle *)recParticles->At(index) ;
rp->SetTraskSegment(index) ;
AliPHOSEmcRecPoint * emc = 0 ;
if(ts->GetEmcIndex()>=0)
- emc = (AliPHOSEmcRecPoint *) fEmcRecPoints->At(ts->GetEmcIndex()) ;
+ emc = (AliPHOSEmcRecPoint *) emcRecPoints->At(ts->GetEmcIndex()) ;
AliPHOSRecPoint * cpv = 0 ;
if(ts->GetCpvIndex()>=0)
- cpv = (AliPHOSRecPoint *) fCpvRecPoints->At(ts->GetCpvIndex()) ;
+ cpv = (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetCpvIndex()) ;
AliPHOSRecPoint * ppsd = 0 ;
if(ts->GetPpsdIndex()>=0)
- ppsd= (AliPHOSRecPoint *) fCpvRecPoints->At(ts->GetPpsdIndex()) ;
+ ppsd= (AliPHOSRecPoint *) cpvRecPoints->At(ts->GetPpsdIndex()) ;
//set momentum and energy first
Float_t e = emc->GetEnergy() ;
cout << "Making PID "<< endl ;
cout << " Headers file: " << fHeaderFileName.Data() << endl ;
cout << " RecPoints branch title: " << fRecPointsTitle.Data() << endl ;
- cout << " TrackSegments Branch title: " << fTSTitle.Data() << endl ;
- cout << " RecParticles Branch title " << fRecparticlesTitle.Data() << endl;
+ cout << " TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ;
+ cout << " RecParticles Branch title " << fRecParticlesTitle.Data() << endl;
cout << "with parameters: " << endl ;
cout << " Maximal EMC - CPV (PPSD) distance (cm) " << fCpvEmcDistance << endl ;
if(fIDOptions.Contains("dis",TString::kIgnoreCase ))
fFormula = new TFormula("Lambda Cut",formula) ;
}
//____________________________________________________________________________
-void AliPHOSPIDv1::WriteRecParticles()
+void AliPHOSPIDv1::WriteRecParticles(Int_t event)
{
- //check, if these branches already exist
- TBranch * pidBranch = 0;
- TBranch * rpBranch = 0;
-
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t pidNotFound = kTRUE ;
- Bool_t rpNotFound = kTRUE ;
-
- for(ibranch = 0;(ibranch <branches->GetEntries())&& pidNotFound && rpNotFound;ibranch++){
- if(pidNotFound){
- pidBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(pidBranch->GetName(),"PHOSPID") == 0) &&
- (fRecparticlesTitle.CompareTo(pidBranch->GetTitle()) == 0) )
- pidNotFound = kFALSE ;
- }
- if(rpNotFound){
- rpBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(rpBranch->GetName(),"PHOSRP") == 0) &&
- (fRecparticlesTitle.CompareTo(rpBranch->GetTitle())==0 ))
- rpNotFound = kFALSE ;
- }
- }
-
- if(!pidNotFound || !rpNotFound) {
- cout << "AliPHOSPIDv1 error: " << endl ;
- cout << " Branch PHOSRP and PHOSPID with title '"<<fRecparticlesTitle.Data()<<"' already exist "<< endl ;
- cout << " can not overwrite " << endl ;
- return ;
- }
+
+ AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * recParticles = gime->RecParticles() ;
+
+ gAlice->GetEvent(event) ;
- //Make branch in TreeR for TrackSegments
+ //Make branch in TreeR for RecParticles
char * filename = 0;
if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
filename = new char[strlen(gAlice->GetBaseFile())+20] ;
//First rp
Int_t bufferSize = 32000 ;
- rpBranch = gAlice->TreeR()->Branch("PHOSRP",&fRecParticles,bufferSize);
- rpBranch->SetTitle(fRecparticlesTitle.Data());
+ TBranch * rpBranch = gAlice->TreeR()->Branch("PHOSRP",&recParticles,bufferSize);
+ rpBranch->SetTitle(fRecParticlesTitle.Data());
if (filename) {
rpBranch->SetFile(filename);
TIter next( rpBranch->GetListOfBranches());
//second, pid
Int_t splitlevel = 0 ;
AliPHOSPIDv1 * pid = this ;
- pidBranch = gAlice->TreeR()->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel);
- pidBranch->SetTitle(fRecparticlesTitle.Data());
+ TBranch * pidBranch = gAlice->TreeR()->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel);
+ pidBranch->SetTitle(fRecParticlesTitle.Data());
if (filename) {
pidBranch->SetFile(filename);
TIter next( pidBranch->GetListOfBranches());
gAlice->TreeR()->Write(0,kOverwrite) ;
}
+
//____________________________________________________________________________
void AliPHOSPIDv1::PlotDispersionCuts()const
{
{
// Print table of reconstructed particles
+ AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * recParticles = gime->RecParticles() ;
+
+
cout << "AliPHOSPIDv1: " << endl ;
- cout << " found " << fRecParticles->GetEntriesFast() << " RecParticles " << endl ;
+ cout << " found " << recParticles->GetEntriesFast() << " RecParticles " << endl ;
if(strstr(option,"all")) { // printing found TS
// << " Primaries list " << endl;
Int_t index ;
- for (index = 0 ; index < fRecParticles->GetEntries() ; index++) {
- AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) fRecParticles->At(index) ;
+ for (index = 0 ; index < recParticles->GetEntries() ; index++) {
+ AliPHOSRecParticle * rp = (AliPHOSRecParticle * ) recParticles->At(index) ;
Text_t particle[11];
switch(rp->GetType()) {
virtual ~AliPHOSPIDv1() ; // dtor
virtual void Exec(Option_t * option);
- virtual char * GetRecParticlesBranch()const {return (char*) fRecparticlesTitle.Data() ;}
- virtual char * GetTrackSegmentsBranch()const{return (char*) fTSTitle.Data(); }
+ virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
+ virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
virtual void Init() ;
-
virtual void PlotDispersionCuts()const ;
-
virtual void Print(Option_t * option)const ;
-
- virtual Bool_t ReadTrackSegments() ;
-
virtual void SetIdentificationMethod(char * option = "CPV DISP" ){fIDOptions = option ;}
-
- virtual void SetShowerProfileCut(char * formula =
- "0.35*0.35 - (x-1.386)*(x-1.386) - 1.707*1.707*(y-1.008)*(y-1.008)") ;
-
+ virtual void SetShowerProfileCut(char * formula = "0.35*0.35 - (x-1.386)*(x-1.386) - 1.707*1.707*(y-1.008)*(y-1.008)") ;
virtual void SetDispersionCut(Float_t cut){fDispersion = cut ; }
virtual void SetCpvtoEmcDistanceCut(Float_t cut ) {fCpvEmcDistance = cut ;}
- virtual void SetTrackSegmentsBranch(const char* title) { fTSTitle = title;}
- virtual void SetRecParticlesBranch (const char* title) { fRecparticlesTitle = title;}
-
- virtual void WriteRecParticles() ;
+ virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
+ virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
+ virtual const char * Version() const { return "pid-v1" ; }
-
private:
+
void MakeRecParticles(void ) ;
- Float_t GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ;
- // Relative Distance PPSD-EMC
+ Float_t GetDistance(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, Option_t * Axis)const ; // Relative Distance PPSD-EMC
TVector3 GetMomentumDirection(AliPHOSEmcRecPoint * emc, AliPHOSRecPoint * cpv, AliPHOSRecPoint * ppsd)const ;
-
void PrintRecParticles(Option_t * option) ;
+ virtual Bool_t ReadTrackSegments(Int_t event) ;
+ virtual void WriteRecParticles(Int_t event) ;
private:
TString fHeaderFileName ; // file name with event header
- TString fTSTitle; // branch name with track segments
+ TString fTrackSegmentsTitle; // branch name with track segments
TString fRecPointsTitle ; // branch name with rec points
- TString fRecparticlesTitle ; // branch name with rec particles
-
+ TString fRecParticlesTitle ; // branch name with rec particles
TString fIDOptions ; // PID option
-
Int_t fNEvent ; // current event number
TObjArray * fEmcRecPoints ; // ! initial EMC RecPoints
TObjArray * fCpvRecPoints ; // ! initial CPV RecPoints
AliPHOSClusterizer * fClusterizer ; // !
AliPHOSTrackSegmentMaker * fTSMaker ; // !
- AliPHOSGeometry * fGeom ; // !pointer to PHOS geometry
TFormula * fFormula ; // formula to define cut on the shouer elips axis
Float_t fDispersion ; // dispersion cut
Float_t fCpvEmcDistance ; // Max EMC-CPV distance
- Bool_t fIsInitialized ; // kTRUE is inifialized
-
-
ClassDef( AliPHOSPIDv1,1) // Particle identifier implementation version 1
};
#include "AliPHOSPpsdRecPoint.h"
#include "AliPHOSCpvRecPoint.h"
#include "AliRun.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSPpsdRecPoint)
// ctor
fMulDigit = 0 ;
- fGeom = AliPHOSGeometry::GetInstance() ;
fLocPos.SetX(1000000.) ; //Local position should be evaluated
}
Float_t x = 0. ;
Float_t z = 0. ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
AliPHOSDigit * digit ;
Int_t iDigit;
Int_t relid[4] ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
AliPHOSDigit *digit = (AliPHOSDigit *) digits->At(fDigitsList[0]) ;
fCable = checked ;
fCer = checker ;
fMessage = message ;
+ fEvent = gAlice->GetEvNumber() ;
}
//____________________________________________________________________________
{
// print the message
- cout << fMessage << endl;
+ cout << "Event# " << fEvent << " " << fMessage << endl;
}
//_________________________________________________________________________
// An alarm object that is instanciated by a AliPHOSQACheckable in response to
-// a AliPHOSQAChecker
+// a AliPHOSQAAlarm
//
//*-- Author: Yves Schutz (SUBATECH)
// --- AliRoot header files ---
+#include "AliRun.h"
class AliPHOSQAAlarm : public TObject {
private:
-
- TString fTime ; // time when the alarm was raised
TString fCable ; // checkable name that raised the alarm
TString fCer ; // checker name that raised the alarm
+ Int_t fEvent ; // event number where alarms occured
TString fMessage ; // the whole error message
+ TString fTime ; // time when the alarm was raised
ClassDef(AliPHOSQAAlarm,1) // description
{
// ctor
// stores checkers in the PHOS QA TTask folder //YSAlice/tasks/QA/PHOS
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceQA = (TTask*)alice->FindObject("tasks/QA") ;
+ TTask * aliceQA = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/QA") ;
TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
if (phosQA) // PHOS QA Tasks container exists
phosQA->Add(this) ;
AliPHOSQAFloatCheckable::AliPHOSQAFloatCheckable(const char * name) : AliPHOSQAVirtualCheckable(name)
{
//ctor initial value is zero
- fType = new char[1] ;
- strcpy(fType,"F") ;
+ fType = "F" ;
fValue = 0. ;
}
AliPHOSQAFloatCheckable::~AliPHOSQAFloatCheckable()
{
// dtor
- delete fType ;
}
AliPHOSQAIntCheckable::AliPHOSQAIntCheckable(const char * name) : AliPHOSQAVirtualCheckable(name)
{
//ctor initial value is zero
- fType = new char[1] ;
- strcpy(fType,"I") ;
+ fType = "I" ;
fValue = 0 ;
}
AliPHOSQAIntCheckable::~AliPHOSQAIntCheckable()
{
// dtor
- delete fType ;
}
//____________________________________________________________________________
TString rv ;
Float_t checked = 0. ;
- if ( strcmp(fCheckable->HasA(),"I") && strcmp(fCheckable->HasA(),"F") ) {
+ if ( (fCheckable->HasA() == "I") && (fCheckable->HasA() == "F") ) {
cout << " ERROR : checker " << GetName() << " says you got the wrong checkable "
<< fCheckable->GetName() << endl ;
cout << " or the checkable has no value !" << endl ;
//____________________________________________________________________________
AliPHOSQAObjectCheckable::AliPHOSQAObjectCheckable(const char * name) : AliPHOSQAVirtualCheckable(name)
{
- fType = new char[1] ;
- strcpy(fType,"O") ;
+ fType = "O" ;
fObject = 0 ;
}
#include "TClass.h"
#include "TFolder.h"
#include "TROOT.h"
+#include "TTree.h"
// --- Standard library ---
#include "AliPHOSQAVirtualCheckable.h"
#include "AliPHOSQAChecker.h"
#include "AliPHOSQAAlarm.h"
+#include "AliPHOSGetter.h"
+#include "AliPHOS.h"
ClassImp(AliPHOSQAVirtualCheckable)
AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
{
// ctor, creates the task(s)
+ fType = "" ;
fChange = kFALSE ;
// create a new folder that will hold the list of alarms
- // get the alice folder
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
// the folder that contains the alarms for PHOS
- fAlarms = (TFolder*)alice->FindObject("folders/QAAlarms/PHOS");
+ fAlarms = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/QAAlarms/PHOS");
// make it the owner of the objects that it contains
fAlarms->SetOwner() ;
- // add the alarms list to //YSAlice/folders/QAAlarms/PHOS
- TList * alarms = new TList() ; // deleted when fAlarms is deleted
+ // add the alarms list to //YSAlice/WhiteBoard/QAAlarms/PHOS
+ TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
alarms->SetName(name) ;
fAlarms->Add(alarms) ;
fChecker = 0 ;
-
}
//____________________________________________________________________________
{
// ctor
delete fAlarms ;
- delete fType ;
}
//____________________________________________________________________________
void AliPHOSQAVirtualCheckable::Alarms() const
{
// Prints all the alarms
- TList * alarms = GetAlarms() ;
+ TObjArray * alarms = GetAlarms() ;
if (alarms->IsEmpty() )
cout << " No alarms raised for checkable " << GetName() << endl ;
else {
//____________________________________________________________________________
void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
{
- // Raise an alarm and store it in the appropriate folder : //YSAlice/folders/QAAlarms/PHOS/..
+ // Raise an alarm and store it in the appropriate folder : //YSAlice/WhiteBoard/QAAlarms/PHOS/..
// cout << message ;
AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
GetAlarms()->Add(alarm) ;
void AliPHOSQAVirtualCheckable::ResetAlarms()
{
// resets the list of alarms (delete the alarms from the list)
- TList * alarms = GetAlarms() ;
+ TObjArray * alarms = GetAlarms() ;
if (alarms->IsEmpty() )
cout << " No alarms raised for checkable " << GetName() << endl ;
else {
void Alarms() const ;
void CheckMe() ;
virtual Bool_t HasChanged() const { return fChange ; }
- TList * GetAlarms() const { return (TList*)fAlarms->FindObject(GetName()) ; }
+ TObjArray * GetAlarms() const { return (TObjArray*)fAlarms->FindObject(GetName()) ; }
virtual Float_t GetValue() const = 0 ;
- char * HasA() const { return fType ; }
+ TString HasA() const { return fType ; }
virtual void Print() const = 0 ;
void RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) ;
void RemoveChecker(AliPHOSQAChecker *ch) ;
protected:
AliPHOSQAChecker * fChecker ; // the task(s) that is going to act on the checkable
- char * fType ; //[1] I, F, or O
- TFolder * fAlarms ; // folder that contains the PHOS alarms
- Bool_t fChange ; // tells if the checkable has been updated
+ TString fType ; // I, F, or O
+ TFolder * fAlarms ; // folder that contains the PHOS alarms
+ Bool_t fChange ; // tells if the checkable has been updated
ClassDef(AliPHOSQAVirtualCheckable,1) // description
#include "AliPHOSGeometry.h"
#include "AliPHOSDigit.h"
#include "AliPHOSRecPoint.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSRecPoint)
{
// ctor
- fGeom = (AliPHOSGeometry*) AliPHOSGeometry::GetInstance() ;
fMaxTrack = 200 ;
fPHOSMod = 0;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ fGeom = (AliPHOSGeometry*)gime->PHOSGeometry();
}
//____________________________________________________________________________
case kButton1Down:{
AliPHOSDigit * digit ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
+
Int_t iDigit;
Int_t relid[4] ;
if( fPHOSMod == 0){
Int_t relid[4] ;
- AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
fPHOSMod = relid[0];
#include "AliRecPoint.h"
#include "AliPHOSDigit.h"
-#include "AliPHOSGeometry.h"
class AliPHOSRecPoint : public AliRecPoint {
}
if(strcmp(branch,"Digits") == 0){
- fDigitizer->SetDigitsBranch(title) ;
- fClusterizer->SetDigitsBranch(title) ;
+ fDigitizer->SetName(title) ;
+ fClusterizer->SetName(title) ;
fDigitsBranch = title ;
return ;
}
fSDigitsBranch = title ;
break ;
case 16: //"AliPHOSDigitizer"
- fDigitizer->SetDigitsBranch(title) ;
- fClusterizer->SetDigitsBranch(title) ;
+ fDigitizer->SetName(title) ;
+ fClusterizer->SetName(title) ;
fDigitsBranch = title ;
break ;
case 18: //"AliPHOSClusterizer"
//_________________________________________________________________________
// This is a TTask that makes SDigits out of Hits
+// The name of the TTask is also the title of the branch that will contain
+// the created SDigits
+// The title of the TTAsk is the name of the file that contains the hits from
+// which the SDigits are created
// A Summable Digits is the sum of all hits originating
// from one primary in one active cell
// A threshold for assignment of the primary to SDigit is applied
// --- AliRoot header files ---
#include "AliRun.h"
#include "AliPHOSDigit.h"
+#include "AliPHOSGetter.h"
#include "AliPHOSHit.h"
#include "AliPHOSSDigitizer.h"
//____________________________________________________________________________
- AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("AliPHOSSDigitizer","")
+ AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","")
{
// ctor
fA = 0;
fB = 10000000.;
fPrimThreshold = 0.01 ;
- fNevents = 0 ;
- fSDigits = 0 ;
- fHits = 0 ;
- fIsInitialized = kFALSE ;
-
}
//____________________________________________________________________________
-AliPHOSSDigitizer::AliPHOSSDigitizer(const char* headerFile, const char *sDigitsTitle):TTask("AliPHOSSDigitizer","")
+AliPHOSSDigitizer::AliPHOSSDigitizer(const char * headerFile, const char * sDigitsTitle):TTask(sDigitsTitle, headerFile)
{
// ctor
fA = 0;
fB = 10000000.;
fPrimThreshold = 0.01 ;
- fNevents = 0 ;
- fSDigitsTitle = sDigitsTitle ;
- fHeadersFile = headerFile ;
- fIsInitialized = kFALSE ;
-
Init();
}
-//____________________________________________________________________________
-AliPHOSSDigitizer::~AliPHOSSDigitizer()
-{
- // dtor
- if(fSDigits)
- delete fSDigits ;
- if(fHits)
- delete fHits ;
-}
+
//____________________________________________________________________________
void AliPHOSSDigitizer::Init()
{
// attach task SDigitizer to the list of PHOS tasks
//
// Initialization can not be done in the default constructor
-
- if(!fIsInitialized){
-
- if(fHeadersFile.IsNull())
- fHeadersFile="galice.root" ;
-
- TFile * file = (TFile*) gROOT->GetFile(fHeadersFile.Data() ) ;
-
- //if file was not opened yet, read gAlice
- if(file == 0){
- if(fHeadersFile.Contains("rfio"))
- file = TFile::Open(fHeadersFile,"update") ;
- else
- file = new TFile(fHeadersFile.Data(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ;
- }
-
- fHits = new TClonesArray("AliPHOSHit",1000);
- fSDigits = new TClonesArray("AliPHOSDigit",1000);
-
- //add Task to //YSAlice/tasks/(S)Diditizer/PHOS
- TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
- TTask * aliceSD = (TTask*)alice->FindObject("tasks/(S)Digitizer") ;
- TTask * phosSD = (TTask*)aliceSD->GetListOfTasks()->FindObject("PHOS") ;
+ //============================================================= YS
+ // The initialisation is now done by AliPHOSGetter
+
+ if( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliPHOSSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ return ;
+ }
+
+ //add Task to //YSAlice/tasks/SDiditizer/PHOS
+ TTask * aliceSD = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/SDigitizer") ;
+ TTask * phosSD = (TTask*)aliceSD->GetListOfTasks()->FindObject("PHOS") ;
+ if ( ! phosSD->GetListOfTasks()->FindObject(GetName()) )
phosSD->Add(this) ;
+ // create a folder on the white board //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/sdigitsTitle
+ gime->Post(GetTitle(), "S", GetName() ) ;
- fIsInitialized = kTRUE ;
- }
}
+
//____________________________________________________________________________
void AliPHOSSDigitizer::Exec(Option_t *option)
{
// Collects all hits in the same active volume into digit
-
- if(!fIsInitialized)
+ if( strcmp(GetName(), "") == 0 )
Init() ;
+
+ if (strstr(option, "print") ) {
+ Print("") ;
+ return ;
+ }
if(strstr(option,"tim"))
gBenchmark->Start("PHOSSDigitizer");
+
+ //Check, if this branch already exits
+ TObjArray * lob = (TObjArray*)gAlice->TreeS()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
- fNevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+ phosfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+ sdigitizerfound = kTRUE ;
+ }
+
+ if ( phosfound || sdigitizerfound ) {
+ cerr << "WARNING: AliPHOSSDigitizer::Exec -> SDigits and/or SDigitizer branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
+
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ TClonesArray * hits = gime->Hits() ;
+
+ Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
Int_t ievent ;
- for(ievent = 0; ievent < fNevents; ievent++){
+ for(ievent = 0; ievent < nevents; ievent++){
gAlice->GetEvent(ievent) ;
gAlice->SetEvent(ievent) ;
if(gAlice->TreeH()==0){
- cout << "AliPHOSSDigitizer: There is no Hit Tree" << endl;
+ cerr << "ERROR: AliPHOSSDigitizer::Exec There is no Hit Tree" << endl;
return ;
}
//set address of the hits
TBranch * branch = gAlice->TreeH()->GetBranch("PHOS");
if (branch)
- branch->SetAddress(&fHits);
+ branch->SetAddress(&hits);
else{
- cout << "ERROR in AliPHOSSDigitizer: "<< endl ;
- cout << " no branch PHOS in TreeH"<< endl ;
- cout << " do nothing " << endl ;
+ cerr << "ERROR: AliPHOSSDigitizer::Exec -> No branch PHOS in TreeH " << endl ;
+ cerr << " Do nothing " << endl ;
return ;
}
-
- fSDigits->Clear();
+
+ TClonesArray * sdigits = gime->SDigits(GetName()) ;
+
+ sdigits->Clear();
Int_t nSdigits = 0 ;
- //Now made SDigits from hits, for PHOS it is the same, so just copy
+ //Now make SDigits from hits, for PHOS it is the same, so just copy
Int_t itrack ;
for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){
-
+
//=========== Get the PHOS branch from Hits Tree for the Primary track itrack
branch->GetEntry(itrack,0);
-
Int_t i;
- for ( i = 0 ; i < fHits->GetEntries() ; i++ ) {
- AliPHOSHit * hit = (AliPHOSHit*)fHits->At(i) ;
-
+ for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
+ const AliPHOSHit * hit = gime->Hit(i) ;
// Assign primary number only if contribution is significant
+
if( hit->GetEnergy() > fPrimThreshold)
- new((*fSDigits)[nSdigits]) AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
+ new((*sdigits)[nSdigits]) AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
else
- new((*fSDigits)[nSdigits]) AliPHOSDigit( -1 , hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
+ new((*sdigits)[nSdigits]) AliPHOSDigit( -1 , hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
nSdigits++ ;
}
-
+
} // loop over tracks
- fSDigits->Sort() ;
-
- nSdigits = fSDigits->GetEntriesFast() ;
- fSDigits->Expand(nSdigits) ;
+ sdigits->Sort() ;
+ nSdigits = sdigits->GetEntriesFast() ;
+ sdigits->Expand(nSdigits) ;
Int_t i ;
for (i = 0 ; i < nSdigits ; i++) {
- AliPHOSDigit * digit = (AliPHOSDigit *) fSDigits->At(i) ;
+ AliPHOSDigit * digit = (AliPHOSDigit *) sdigits->At(i) ;
digit->SetIndexInList(i) ;
}
if(gAlice->TreeS() == 0)
gAlice->MakeTree("S") ;
- //check, if this branch already exits?
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
-
- TObjArray * branches = gAlice->TreeS()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t sdigitizerNotFound = kTRUE ;
-
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-
- if(phosNotFound){
- sdigitsBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp("PHOS",sdigitsBranch->GetName())==0 ) &&
- (fSDigitsTitle.CompareTo(sdigitsBranch->GetTitle()) == 0) )
- phosNotFound = kFALSE ;
- }
- if(sdigitizerNotFound){
- sdigitizerBranch = (TBranch *) branches->At(ibranch) ;
- if( (strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0)&&
- (fSDigitsTitle.CompareTo(sdigitizerBranch->GetTitle()) == 0) )
- sdigitizerNotFound = kFALSE ;
- }
- }
-
- if(!(sdigitizerNotFound && phosNotFound)){
- cout << "AliPHOSSdigitizer error:" << endl ;
- cout << "Can not overwrite existing branches: do not write" << endl ;
- return ;
- }
-
//Make (if necessary) branches
char * file =0;
if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
//First list of sdigits
Int_t bufferSize = 32000 ;
- sdigitsBranch = gAlice->TreeS()->Branch("PHOS",&fSDigits,bufferSize);
- sdigitsBranch->SetTitle(fSDigitsTitle.Data());
+ TBranch * sdigitsBranch = gAlice->TreeS()->Branch("PHOS",&sdigits,bufferSize);
+ sdigitsBranch->SetTitle(GetName());
if (file) {
sdigitsBranch->SetFile(file);
TIter next( sdigitsBranch->GetListOfBranches());
cwd->cd();
}
- //second - SDigitizer
+ //Next - SDigitizer
Int_t splitlevel = 0 ;
AliPHOSSDigitizer * sd = this ;
- sdigitizerBranch = gAlice->TreeS()->Branch("AliPHOSSDigitizer","AliPHOSSDigitizer",
+ TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliPHOSSDigitizer","AliPHOSSDigitizer",
&sd,bufferSize,splitlevel);
- sdigitizerBranch->SetTitle(fSDigitsTitle.Data());
+ sdigitizerBranch->SetTitle(GetName());
if (file) {
sdigitizerBranch->SetFile(file);
TIter next( sdigitizerBranch->GetListOfBranches());
gBenchmark->Stop("PHOSSDigitizer");
cout << "AliPHOSSDigitizer:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("PHOSSDigitizer") << " seconds for SDigitizing "
- << gBenchmark->GetCpuTime("PHOSSDigitizer")/fNevents << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("PHOSSDigitizer")/nevents << " seconds per event " << endl ;
cout << endl ;
}
void AliPHOSSDigitizer::SetSDigitsBranch(const char * title )
{
// Setting title to branch SDigits
- if(!fSDigitsTitle.IsNull())
- cout << "AliPHOSSdigitizer: changing SDigits file from " <<fSDigitsTitle.Data() << " to " << title << endl ;
- fSDigitsTitle=title ;
+
+ TString stitle(title) ;
+
+ // check if branch with title already exists
+ TBranch * sdigitsBranch = (TBranch*)gAlice->TreeS()->GetListOfBranches()->FindObject("PHOS") ;
+ TBranch * sdigitizerBranch = (TBranch*)gAlice->TreeS()->GetListOfBranches()->FindObject("AliPHOSSDigitizer") ;
+ const char * sdigitsTitle = sdigitsBranch ->GetTitle() ;
+ const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ;
+ if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){
+ cerr << "ERROR: AliPHOSSdigitizer::SetSDigitsBranch -> Cannot overwrite existing branch with title " << title << endl ;
+ return ;
+ }
+
+ cout << "AliPHOSSdigitizer::SetSDigitsBranch -> Changing SDigits file from " << GetName() << " to " << title << endl ;
+
+ SetName(title) ;
+
+ // Post to the WhiteBoard
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ gime->Post(GetTitle(), "S", GetName()) ;
}
+
//__________________________________________________________________
void AliPHOSSDigitizer::Print(Option_t* option)const
{
// Prints parameters of SDigitizer
cout << "------------------- "<< GetName() << " -------------" << endl ;
- cout << " Writing SDigitis to branch with title " << fSDigitsTitle.Data() << endl ;
+ cout << " Writing SDigitis to branch with title " << GetName() << endl ;
cout << " with digitization parameters A = " << fA << endl ;
cout << " B = " << fB << endl ;
cout << " Threshold for Primary assignment= " << fPrimThreshold << endl ;
void AliPHOSSDigitizer::PrintSDigits(Option_t * option)
{
// Prints list of digits produced in the current pass of AliPHOSDigitizer
-
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * sdigits = gime->SDigits(GetName()) ;
+
cout << "AliPHOSSDigitizer: " << endl ;
- cout << " Number of entries in SDigits list " << fSDigits->GetEntriesFast() << endl ;
+ cout << " Number of entries in SDigits list " << sdigits->GetEntriesFast() << endl ;
cout << endl ;
if(strstr(option,"all")){// print all digits
AliPHOSDigit * digit;
cout << "SDigit Id " << " Amplitude " << " Index " << " Nprim " << " Primaries list " << endl;
Int_t index ;
- for (index = 0 ; index < fSDigits->GetEntries() ; index++) {
- digit = (AliPHOSDigit * ) fSDigits->At(index) ;
+ for (index = 0 ; index < sdigits->GetEntries() ; index++) {
+ digit = (AliPHOSDigit * ) sdigits->At(index) ;
cout << setw(8) << digit->GetId() << " " << setw(3) << digit->GetAmp() << " "
<< setw(6) << digit->GetIndexInList() << " "
<< setw(5) << digit->GetNprimary() <<" ";
}
}
+
+//____________________________________________________________________________
+void AliPHOSSDigitizer::UseHitsFrom(const char * filename)
+{
+ SetTitle(filename) ;
+ Init() ;
+}
public:
AliPHOSSDigitizer() ; // ctor
- AliPHOSSDigitizer(const char* HeaderFile,const char *SdigitsTitle = 0) ;
- virtual ~AliPHOSSDigitizer() ; // dtor
+ AliPHOSSDigitizer(const char* HeaderFile,const char *SdigitsTitle = "No Name") ;
+ virtual ~AliPHOSSDigitizer(){} // dtor
Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; }
Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); }
virtual void Exec(Option_t *option);
- Float_t GetPedestalParameter()const {return fA;}
- Float_t GetCalibrationParameter()const{return fB;}
- char * GetSDigitsBranch()const{return (char*) fSDigitsTitle.Data();}
+ const Float_t GetPedestalParameter()const {return fA;}
+ const Float_t GetCalibrationParameter()const{return fB;}
+ const char * GetSDigitsBranch()const{return GetName();}
virtual void Print(Option_t* option) const ;
void SetSlopeParameter(Float_t B){fB = B ;}
void SetSDigitsBranch(const char * title ) ;
+ void UseHitsFrom(const char * filename) ;
+
Bool_t operator == (const AliPHOSSDigitizer & sd) const ;
private:
void PrintSDigits(Option_t * option) ;
private:
- Float_t fA ; //Pedestal parameter
- Float_t fB ; //Slope Digitizition parameters
- Int_t fNevents ; // Number of events to digitize
+
+ Float_t fA ; // Pedestal parameter
+ Float_t fB ; // Slope Digitizition parameters
Float_t fPrimThreshold ; // To store primari if Elos > threshold
- TString fSDigitsTitle ; // title of SDigits branch
- TString fHeadersFile ; //input file
- Bool_t fIsInitialized ; // kTRUE if SDigitizer is initialized
- TClonesArray * fSDigits ; //! list of SDigits
- TClonesArray * fHits ; //!
ClassDef(AliPHOSSDigitizer,1) // description
//____________________________________________________________________________
- AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : TTask()
+ AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : TTask("","")
{
+ // ctor
}
+
//____________________________________________________________________________
-AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(char * header,char * branch): TTask("AliPHOSTrackSegmentMaker","")
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name): TTask(name, headerFile)
{
+ // ctor
}
public:
AliPHOSTrackSegmentMaker() ;
- AliPHOSTrackSegmentMaker(char* headerFile, char* branchTitle) ;
+ AliPHOSTrackSegmentMaker(const char* headerFile, const char* name) ;
virtual ~ AliPHOSTrackSegmentMaker(){
// dtor
// virtual void Set... // method to choose recPoints: along z only, along x ...???
// virtual void SetChoosingAlgirithm() = 0 ;
// virtual void SetMaxEmcCpvDistance(Float_t r) = 0 ;
- virtual Bool_t ReadRecPoints() = 0 ;
+ virtual Bool_t ReadRecPoints(Int_t ievent) = 0 ;
virtual void SetRecPointsBranch(const char * title) = 0 ;
virtual void SetTrackSegmentsBranch(const char * title) = 0 ;
- virtual void WriteTrackSegments() = 0 ;
+ virtual const char * Version() const = 0 ;
+ virtual void WriteTrackSegments(Int_t event) = 0 ;
ClassDef( AliPHOSTrackSegmentMaker,1) // Algorithm class to make PHOS track segments (Base Class)
// --- ROOT system ---
#include "TROOT.h"
#include "TFile.h"
+#include "TFolder.h"
#include "TTree.h"
#include "TSystem.h"
#include "TBenchmark.h"
#include "AliPHOSCpvRecPoint.h"
#include "AliPHOSPpsdRecPoint.h"
#include "AliPHOSLink.h"
+#include "AliPHOSGetter.h"
#include "AliPHOS.h"
#include "AliRun.h"
//____________________________________________________________________________
AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() : AliPHOSTrackSegmentMaker()
{
- // ctor
- SetTitle("version 1") ;
- SetName("AliPHOSTrackSegmentMaker") ;
- fR0 = 10. ;
- fEmcFirst = 0 ;
- fEmcLast = 0 ;
- fCpvFirst = 0 ;
- fCpvLast = 0 ;
- fPpsdFirst= 0 ;
- fPpsdLast = 0 ;
- fLinkLowArray = 0 ;
- fLinkUpArray = 0 ;
- fIsInitialized = kFALSE ;
+ // default ctor (to be used mainly by Streamer)
+
+ fR0 = 10. ;
+ fEmcFirst = 0 ;
+ fEmcLast = 0 ;
+ fCpvFirst = 0 ;
+ fCpvLast = 0 ;
+ fPpsdFirst = 0 ;
+ fPpsdLast = 0 ;
+ fLinkLowArray = 0 ;
+ fLinkUpArray = 0 ;
+ fHeaderFileName = "" ;
+ fRecPointsBranchTitle = "" ;
+ fTrackSegmentsBranchTitle = "" ;
}
+
//____________________________________________________________________________
- AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char* headerFile, const char* branchTitle):
-AliPHOSTrackSegmentMaker()
+ AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char * headerFile, const char * name) : AliPHOSTrackSegmentMaker(headerFile, name)
{
// ctor
- SetTitle("version 1") ;
- SetName("AliPHOSTrackSegmentMaker") ;
- fR0 = 10. ;
- fEmcFirst = 0 ;
- fEmcLast = 0 ;
- fCpvFirst = 0 ;
- fCpvLast = 0 ;
- fPpsdFirst= 0 ;
- fPpsdLast = 0 ;
- fHeaderFileName = headerFile ;
- fRecPointsBranchTitle = branchTitle ;
- fIsInitialized = kFALSE ;
+ fR0 = 10. ;
+ fEmcFirst = 0 ;
+ fEmcLast = 0 ;
+ fCpvFirst = 0 ;
+ fCpvLast = 0 ;
+ fPpsdFirst = 0 ;
+ fPpsdLast = 0 ;
+
+ fHeaderFileName = GetTitle() ;
+ fRecPointsBranchTitle = GetName() ;
+ fTrackSegmentsBranchTitle = GetName() ;
- Init() ;
+ TString tempo(GetName()) ;
+ tempo.Append(Version()) ;
+ SetName(tempo.Data()) ;
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
-
- if(!fIsInitialized){
- if(fHeaderFileName.IsNull())
- fHeaderFileName = "galice.root" ;
-
- TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data() ) ;
-
- if(file == 0){
- if(fHeaderFileName.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFileName.Data(),"update") ;
- else
- file = new TFile(fHeaderFileName.Data(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ;
- }
-
- AliPHOS * phos = (AliPHOS *) gAlice->GetDetector("PHOS") ;
- fGeom = AliPHOSGeometry::GetInstance(phos->GetGeometry()->GetName(),phos->GetGeometry()->GetTitle() );
-
- fEmcRecPoints = new TObjArray(200) ;
- fCpvRecPoints = new TObjArray(200) ;
- fClusterizer = new AliPHOSClusterizerv1() ;
-
- fTrackSegments = new TClonesArray("AliPHOSTrackSegment",200) ;
+ Init() ;
- fLinkLowArray = new TClonesArray("AliPHOSLink", 1000);
- fLinkUpArray = new TClonesArray("AliPHOSLink", 1000);
-
- fIsInitialized = kTRUE ;
- }
}
//____________________________________________________________________________
// Finds first and last indexes between which
// clusters from one PHOS module are
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
//First EMC clusters
- Int_t totalEmc = fEmcRecPoints->GetEntriesFast() ;
+ Int_t totalEmc = emcRecPoints->GetEntriesFast() ;
for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) &&
- (((AliPHOSRecPoint *) fEmcRecPoints->At(fEmcLast))->GetPHOSMod() == fModule );
+ (((AliPHOSRecPoint *) emcRecPoints->At(fEmcLast))->GetPHOSMod() == fModule );
fEmcLast ++) ;
//Now CPV clusters
- Int_t totalCpv = fCpvRecPoints->GetEntriesFast() ;
+ Int_t totalCpv = cpvRecPoints->GetEntriesFast() ;
- if(fModule <= fGeom->GetNCPVModules()){ // in CPV geometry
+ if(fModule <= geom->GetNCPVModules()){ // in CPV geometry
for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) &&
- (((AliPHOSRecPoint *) fCpvRecPoints->At(fCpvLast))->GetPHOSMod() == fModule );
+ (((AliPHOSRecPoint *) cpvRecPoints->At(fCpvLast))->GetPHOSMod() == fModule );
fCpvLast ++) ;
fPpsdFirst = fCpvLast ; //To avoid scanning RecPoints between fPpsdFirst and fPpsdLast
fCpvLast = fPpsdLast ;
//Upper layer first
for(fCpvFirst = fCpvLast; (fCpvLast < totalCpv) &&
- (((AliPHOSPpsdRecPoint *) fCpvRecPoints->At(fCpvLast))->GetPHOSMod() == fModule ) &&
- (((AliPHOSPpsdRecPoint *) fCpvRecPoints->At(fCpvLast))->GetUp()) ;
+ (((AliPHOSPpsdRecPoint *) cpvRecPoints->At(fCpvLast))->GetPHOSMod() == fModule ) &&
+ (((AliPHOSPpsdRecPoint *) cpvRecPoints->At(fCpvLast))->GetUp()) ;
fCpvLast ++) ;
fPpsdLast= fCpvLast ;
for(fPpsdFirst = fPpsdLast; (fPpsdLast < totalCpv) &&
- (((AliPHOSPpsdRecPoint *) fCpvRecPoints->At(fPpsdLast))->GetPHOSMod() == fModule ) &&
- (!((AliPHOSPpsdRecPoint *) fCpvRecPoints->At(fPpsdLast))->GetUp()) ;
+ (((AliPHOSPpsdRecPoint *) cpvRecPoints->At(fPpsdLast))->GetPHOSMod() == fModule ) &&
+ (!((AliPHOSPpsdRecPoint *) cpvRecPoints->At(fPpsdLast))->GetUp()) ;
fPpsdLast ++) ;
}
}
+
//____________________________________________________________________________
Float_t AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcClu,AliPHOSRecPoint * cpvClu, Bool_t &toofar)const
{
return r ;
}
+//____________________________________________________________________________
+void AliPHOSTrackSegmentMakerv1::Init()
+{
+ // Make all memory allocations that are not possible in default constructor
+
+ if ( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliPHOSTrackSegmentMakerv1::Init -> Could not obtain the Getter object !" << endl ;
+ return ;
+ }
+
+ fLinkLowArray = new TClonesArray("AliPHOSLink", 1000);
+ fLinkUpArray = new TClonesArray("AliPHOSLink", 1000);
+
+ //add Task to //YSAlice/tasks/Reconstructioner/PHOS
+ TTask * aliceRe = (TTask*)gROOT->FindObjectAny("YSAlice/tasks/Reconstructioner") ;
+ TTask * phosRe = (TTask*)aliceRe->GetListOfTasks()->FindObject("PHOS") ;
+ phosRe->Add(this) ;
+ // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/trackSegmentsName
+
+ gime->Post(GetTitle(), "T", taskName.Data() ) ;
+
+}
+
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::MakeLinks()const
{
// which are not further apart from each other than fR0
// and sort them in accordance with this distance
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+
fLinkUpArray->Clear() ;
fLinkLowArray->Clear() ;
Int_t iEmcRP;
for(iEmcRP = fEmcFirst; iEmcRP < fEmcLast; iEmcRP++ ) {
- emcclu = (AliPHOSEmcRecPoint *) fEmcRecPoints->At(iEmcRP) ;
+ emcclu = (AliPHOSEmcRecPoint *) emcRecPoints->At(iEmcRP) ;
Bool_t toofar ;
Int_t iPpsd ;
for(iPpsd = fPpsdFirst; iPpsd < fPpsdLast;iPpsd++ ) {
- ppsd = (AliPHOSRecPoint *) fCpvRecPoints->At(iPpsd) ;
+ ppsd = (AliPHOSRecPoint *) cpvRecPoints->At(iPpsd) ;
Float_t r = GetDistanceInPHOSPlane(emcclu, ppsd, toofar) ;
if(toofar)
Int_t iCpv = 0 ;
for(iCpv = fCpvFirst; iCpv < fCpvLast;iCpv++ ) {
- cpv = (AliPHOSRecPoint *) fCpvRecPoints->At(iCpv) ;
+ cpv = (AliPHOSRecPoint *) cpvRecPoints->At(iCpv) ;
Float_t r = GetDistanceInPHOSPlane(emcclu, cpv, toofar) ;
if(toofar)
// unassigned RecParticles. We assign these RecPoints to TrackSegment and
// remove them from the list of "unassigned".
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ TClonesArray * trackSegments = gime->TrackSegments() ;
+
//Make arrays to mark clusters already chousen
Int_t * emcExist = 0;
if(fEmcLast > fEmcFirst)
if( (emcExist[linkLow->GetEmc()-fEmcFirst]> 0) &&
ppsdExist[linkLow->GetPpsd()-fPpsdFirst] ){ // RecPoints not removed yet
- new ((*fTrackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fEmcRecPoints->At(linkLow->GetEmc()),
+ new ((*trackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) emcRecPoints->At(linkLow->GetEmc()),
nullpointer,
- (AliPHOSRecPoint *)fCpvRecPoints->At(linkLow->GetPpsd()) ) ;
+ (AliPHOSRecPoint *)cpvRecPoints->At(linkLow->GetPpsd()) ) ;
- ((AliPHOSTrackSegment* )fTrackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
+ ((AliPHOSTrackSegment* )trackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
//replace index of emc to negative and shifted index of TS
emcExist[linkLow->GetEmc()-fEmcFirst] = -2 - fNTrackSegments ;
//mark ppsd as used
if(emcExist[linkUp->GetEmc()-fEmcFirst] > 0){ //without ppsd Low => create new TS
- new ((* fTrackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) fEmcRecPoints->At(linkUp->GetEmc()) ,
- (AliPHOSRecPoint *)fCpvRecPoints->At(linkUp->GetPpsd()),
+ new ((* trackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *) emcRecPoints->At(linkUp->GetEmc()) ,
+ (AliPHOSRecPoint *)cpvRecPoints->At(linkUp->GetPpsd()),
nullpointer) ;
- ((AliPHOSTrackSegment *) fTrackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
+ ((AliPHOSTrackSegment *) trackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
fNTrackSegments++ ;
}
else{ // append ppsd Up to existing TS
- ((AliPHOSTrackSegment *)fTrackSegments->At(-2-emcExist[linkUp->GetEmc()-fEmcFirst]))->SetCpvRecPoint((AliPHOSCpvRecPoint *)fCpvRecPoints->At(linkUp->GetPpsd()));
+ ((AliPHOSTrackSegment *)trackSegments->At(-2-emcExist[linkUp->GetEmc()-fEmcFirst]))->SetCpvRecPoint((AliPHOSCpvRecPoint *)cpvRecPoints->At(linkUp->GetPpsd()));
}
emcExist[linkUp->GetEmc()-fEmcFirst] = -1 ; //Mark emc that Cpv was found
Int_t iEmcRP ;
for(iEmcRP = 0; iEmcRP < fEmcLast-fEmcFirst ; iEmcRP++ ){
if(emcExist[iEmcRP] > 0 ){
- new ((*fTrackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *)fEmcRecPoints->At(iEmcRP+fEmcFirst),
+ new ((*trackSegments)[fNTrackSegments]) AliPHOSTrackSegment((AliPHOSEmcRecPoint *)emcRecPoints->At(iEmcRP+fEmcFirst),
nullpointer,
nullpointer ) ;
- ((AliPHOSTrackSegment *) fTrackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
+ ((AliPHOSTrackSegment *) trackSegments->At(fNTrackSegments))->SetIndexInList(fNTrackSegments);
fNTrackSegments++;
}
}
{
// STEERing method
- if(! fIsInitialized) Init() ;
+ if( strcmp(GetName(), "")== 0 )
+ Init() ;
if(strstr(option,"tim"))
- gBenchmark->Start("PHOSTSMaker");
+ gBenchmark->Start("PHOSTrackSegmentMakerv1");
+
+ if(strstr(option,"print")) {
+ Print("") ;
+ return ;
+ }
- Int_t nEvents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ //check, if the branch with name of this" already exits?
+ TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phostsfound = kFALSE, tracksegmentmakerfound = kFALSE ;
- for(fEvent = 0;fEvent< nEvents; fEvent++){
- if(!ReadRecPoints()) //reads RecPoints for event fEvent
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
+
+ while ( (branch = (TBranch*)next()) && (!phostsfound || !tracksegmentmakerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ phostsfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+ tracksegmentmakerfound = kTRUE ;
+ }
+
+ if ( phostsfound || tracksegmentmakerfound ) {
+ cerr << "WARNING: AliPHOSTrackSegmentMakerv1::Exec -> TrackSegments and/or TrackSegmentMaker branch with name "
+ << taskName.Data() << " already exits" << endl ;
+ return ;
+ }
+
+ const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
+ Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t ievent ;
+
+ for(ievent = 0; ievent < nevents; ievent++){
+ if(!ReadRecPoints(ievent)) //reads RecPoints for event ievent
return;
- for(fModule = 1; fModule <= fGeom->GetNModules() ; fModule++ ){
+ for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ){
FillOneModule() ;
}
- WriteTrackSegments() ;
+ WriteTrackSegments(ievent) ;
+
if(strstr(option,"deb"))
PrintTrackSegments(option) ;
+
}
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSTSMaker");
cout << "AliPHOSTSMaker:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("PHOSTSMaker") << " seconds for making TS "
- << gBenchmark->GetCpuTime("PHOSTSMaker")/nEvents << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("PHOSTSMaker")/nevents << " seconds per event " << endl ;
cout << endl ;
}
-
-
+
}
+
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::Print(Option_t * option)const
{
// Print TrackSegmentMaker parameters
- if(fIsInitialized){
+ if( strcmp(GetName(), "") != 0 ) {
cout << "======== AliPHOSTrackSegmentMakerv1 ========" << endl ;
cout << "Making Track segments "<< endl ;
cout << " Headers file: " << fHeaderFileName.Data() << endl ;
cout << " RecPoints branch file name: " << fRecPointsBranchTitle.Data() << endl ;
- cout << " TrackSegments Branch file name: " << fTSBranchTitle.Data() << endl ;
+ cout << " TrackSegments Branch file name: " << fTrackSegmentsBranchTitle.Data() << endl ;
cout << "with parameters: " << endl ;
cout << " Maximal EMC - CPV (PPSD) distance (cm)" << fR0 << endl ;
cout << "============================================" << endl ;
cout << "AliPHOSTrackSegmentMakerv1 not initialized " << endl ;
}
//____________________________________________________________________________
-Bool_t AliPHOSTrackSegmentMakerv1::ReadRecPoints()
+Bool_t AliPHOSTrackSegmentMakerv1::ReadRecPoints(Int_t event)
{
- // Reads Emc and CPV recPoints with given title (fRecPointsBranchTitle)
+ // Reads Emc and CPV recPoints
// made previously with Clusterizer.
//Make some initializations
- fEmcRecPoints->Clear() ;
- fCpvRecPoints->Clear() ;
- fTrackSegments->Clear() ;
+
fNTrackSegments = 0 ;
fEmcFirst = 0 ;
fEmcLast = 0 ;
fPpsdLast = 0 ;
- gAlice->GetEvent(fEvent) ;
+ gAlice->GetEvent(event) ;
+ gAlice->SetEvent(event) ;
// Get TreeR header from file
if(gAlice->TreeR()==0){
- char treeName[20];
- sprintf(treeName,"TreeR%d",fEvent);
- cout << "Error in AliPHOSTrackSegmentMakerv1 : no "<<treeName << endl ;
- cout << " Do nothing " << endl ;
- return kFALSE ;
+ cerr << "ERROR: AliPHOSTrackSegmentMakerv1::ReadRecPoints -> There is no Reconstruction Tree" << endl;
+ return kFALSE;
}
- //Find RecPoints with title fRecPointsBranchTitle
- TBranch * emcBranch = 0;
- TBranch * cpvBranch = 0;
- TBranch * clusterizerBranch = 0;
-
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t emcNotFound = kTRUE ;
- Bool_t cpvNotFound = kTRUE ;
- Bool_t clusterizerNotFound = kTRUE ;
+ // Find RecPoints
+ TBranch * emcbranch = 0;
+ TBranch * cpvbranch = 0;
+ TBranch * clusterizerbranch = 0;
+ TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
+ TString taskName(GetName()) ;
+ taskName.ReplaceAll(Version(), "") ;
- if(emcNotFound){
- emcBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(emcBranch->GetTitle())==0 )
- if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0) {
- emcNotFound = kFALSE ;
- }
+ while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phosemcfound = kTRUE ;
+ emcbranch = branch ;
}
- if(cpvNotFound){
- cpvBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(cpvBranch->GetTitle())==0 )
- if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
- cpvNotFound = kFALSE ;
- }
-
- if(clusterizerNotFound){
- clusterizerBranch = (TBranch *) branches->At(ibranch) ;
- if( fRecPointsBranchTitle.CompareTo(clusterizerBranch->GetTitle()) == 0)
- if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0)
- clusterizerNotFound = kFALSE ;
+ else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ phoscpvfound = kTRUE ;
+ cpvbranch = branch ;
+
+ } else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
+ clusterizerfound = kTRUE ;
+ clusterizerbranch = branch ;
}
-
}
+ if ( !phosemcfound || !phoscpvfound || !clusterizerfound ) {
+ cerr << "WARNING: AliPHOSTrackSegmentMakerv1::ReadRecPoints -> emc(cpv)RecPoints and/or Clusterizer branch with name " << taskName.Data()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
- if(clusterizerNotFound || emcNotFound || cpvNotFound){
- cout << "AliPHOSTrackSegmentMakerv1: " << endl ;
- cout << " Can't find Branch with RecPoints or Clusterizer " ;
- cout << " Do nothing" <<endl ;
- return kFALSE ;
- }
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- emcBranch->SetAddress(&fEmcRecPoints) ;
- cpvBranch->SetAddress(&fCpvRecPoints) ;
- clusterizerBranch->SetAddress(&fClusterizer) ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ emcRecPoints->Clear() ;
+ emcbranch->SetAddress(&emcRecPoints) ;
- emcBranch->GetEntry(0) ;
- cpvBranch->GetEntry(0) ;
- clusterizerBranch->GetEntry(0) ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ cpvRecPoints->Clear() ;
+ cpvbranch->SetAddress(&cpvRecPoints) ;
+
+
+ AliPHOSClusterizer * clusterizer = 0 ;
+ clusterizerbranch->SetAddress(&clusterizer) ;
+ clusterizerbranch->GetEntry(0) ;
+ TString clusterizerName( fTrackSegmentsBranchTitle ) ;
+ clusterizerName.Append(clusterizer->Version()) ;
+ clusterizer = gime->Clusterizer(clusterizerName) ;
+
+ emcbranch->GetEntry(0) ;
+ cpvbranch->GetEntry(0) ;
+ clusterizerbranch->GetEntry(0) ;
return kTRUE ;
}
+
//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::WriteTrackSegments()
+void AliPHOSTrackSegmentMakerv1::WriteTrackSegments(Int_t event)
{
// Writes found TrackSegments to TreeR. Creates branches
// "PHOSTS" and "AliPHOSTrackSegmentMaker" with the same title.
// first we check, if branches with the same title already exist.
// If yes - exits without writing.
- //First, check, if branches already exist
- TBranch * tsMakerBranch = 0;
- TBranch * tsBranch = 0;
-
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t tsMakerNotFound = kTRUE ;
- Bool_t tsNotFound = kTRUE ;
-
- for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
- if(tsMakerNotFound){
- tsMakerBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0) &&
- (fTSBranchTitle.CompareTo( tsMakerBranch->GetTitle())==0 ))
- tsMakerNotFound = kFALSE ;
- }
- if(tsNotFound){
- tsBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(tsBranch->GetName(),"PHOSTS") == 0) &&
- (fTSBranchTitle.CompareTo( tsBranch->GetTitle())==0 ))
- tsNotFound = kFALSE ;
- }
- }
+ AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
+ TClonesArray * trackSegments = gime->TrackSegments() ;
- if(!(tsMakerNotFound && tsNotFound )){
- cout << "AliPHOSTrackSegmentMakerv1 error:"<< endl ;
- cout << " Branches PHOSTS and AliPHOSTrackSegementMaker " << endl ;
- cout << " with title '"<<fTSBranchTitle.Data() << "' already exist " << endl ;
- cout << " can not overwrite " << endl ;
- return ;
- }
+ gAlice->GetEvent(event) ;
//Make branch in TreeR for TrackSegments
char * filename = 0;
//First TS
Int_t bufferSize = 32000 ;
- tsBranch = gAlice->TreeR()->Branch("PHOSTS",&fTrackSegments,bufferSize);
- tsBranch->SetTitle(fTSBranchTitle.Data());
+ TBranch * tsBranch = gAlice->TreeR()->Branch("PHOSTS",&trackSegments,bufferSize);
+ tsBranch->SetTitle(fTrackSegmentsBranchTitle.Data());
if (filename) {
tsBranch->SetFile(filename);
TIter next( tsBranch->GetListOfBranches());
//Second -TSMaker
Int_t splitlevel = 0 ;
AliPHOSTrackSegmentMakerv1 * ts = this ;
- tsMakerBranch = gAlice->TreeR()->Branch("AliPHOSTrackSegmentMaker","AliPHOSTrackSegmentMakerv1",
+ TBranch * tsMakerBranch = gAlice->TreeR()->Branch("AliPHOSTrackSegmentMaker","AliPHOSTrackSegmentMakerv1",
&ts,bufferSize,splitlevel);
- tsMakerBranch->SetTitle(fTSBranchTitle.Data());
+ tsMakerBranch->SetTitle(fTrackSegmentsBranchTitle.Data());
if (filename) {
tsMakerBranch->SetFile(filename);
TIter next( tsMakerBranch->GetListOfBranches());
// option deb - prints # of found TrackSegments
// option deb all - prints as well indexed of found RecParticles assigned to the TS
+ TClonesArray * trackSegments = AliPHOSGetter::GetInstance()->TrackSegments() ;
cout << "AliPHOSTrackSegmentMakerv1: " << endl ;
- cout << " Found " << fTrackSegments->GetEntriesFast() << " trackSegments " << endl ;
+ cout << " Found " << trackSegments->GetEntriesFast() << " trackSegments " << endl ;
if(strstr(option,"all")) { // printing found TS
cout << "TrackSegment # " << " EMC RP# " << " CPV RP# " << " PPSD RP#" << endl ;
Int_t index;
- for (index = 0 ; index <fTrackSegments->GetEntriesFast() ; index++) {
- AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )fTrackSegments->At(index) ;
+ for (index = 0 ; index <trackSegments->GetEntriesFast() ; index++) {
+ AliPHOSTrackSegment * ts = (AliPHOSTrackSegment * )trackSegments->At(index) ;
cout<<" "<< setw(4) << ts->GetIndexInList() << " "
<<setw(4) << ts->GetEmcIndex()<< " "
<<setw(4) << ts->GetCpvIndex()<< " "
public:
AliPHOSTrackSegmentMakerv1() ;
- AliPHOSTrackSegmentMakerv1(const char* headerFile,const char* branchTitle = 0) ;
+ AliPHOSTrackSegmentMakerv1(const char* headerFile, const char* name = 0) ;
AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) {
// cpy ctor: no implementation yet
// requested by the Coding Convention
virtual ~ AliPHOSTrackSegmentMakerv1() ; // dtor
virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;}
- virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTSBranchTitle.Data() ;}
+ virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTrackSegmentsBranchTitle.Data() ;}
virtual void Exec(Option_t * option) ;
void FillOneModule() ; // Finds range in which RecPoints belonging current PHOS module are
void MakeLinks() const; //Evaluates distances(links) between EMC and PPSD
void MakePairs() ; //Finds pairs(triplets) with smallest link
virtual void Print(Option_t * option) const ;
- virtual Bool_t ReadRecPoints() ;
virtual void SetMaxEmcPpsdDistance(Float_t r){ fR0 = r ;}
virtual void SetRecPointsBranch(const char * title) { fRecPointsBranchTitle = title ;}
- virtual void SetTrackSegmentsBranch(const char * title){ fTSBranchTitle = title ; }
- virtual void WriteTrackSegments() ;
+ virtual void SetTrackSegmentsBranch(const char * title){ fTrackSegmentsBranchTitle = title ; }
+ virtual const char * Version() const { return "tsm-v1" ; }
AliPHOSTrackSegmentMakerv1 & operator = (const AliPHOSTrackSegmentMakerv1 & ) {
// assignement operator requested by coding convention but not needed
return *this ;
}
+
private:
Float_t GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * EmcClu , AliPHOSRecPoint * Ppsd , Bool_t & TooFar )const ; // see R0
void Init() ;
void PrintTrackSegments(Option_t *option) ;
+ virtual Bool_t ReadRecPoints(Int_t event) ;
+ virtual void WriteTrackSegments(Int_t event) ;
private:
TString fHeaderFileName ; // name of the file which contains gAlice, Tree headers etc.
TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored
- TString fTSBranchTitle ; // name of the file, where TrackSegment branchs is stored
- AliPHOSClusterizer * fClusterizer ; // !
- Int_t fNTrackSegments ; // number of track segments found
- AliPHOSGeometry * fGeom ; //! pointer to PHOS geometry
- Int_t fEvent ; // ! event being precessed
- TObjArray * fEmcRecPoints ; // ! List of EMC Rec Points
- TObjArray * fCpvRecPoints ; // ! List of CPV/PPSD recPoints
- TClonesArray * fTrackSegments; // ! list of final track segments
-
-
- Bool_t fIsInitialized ; // kTRUE if track segment maker is initialized
+ TString fTrackSegmentsBranchTitle ; // name of the file, where TrackSegment branchs is stored
+ Int_t fNTrackSegments ; // number of track segments found
Float_t fR0 ; // Maximum distance between a EMC RecPoint and a PPSD RecPoint
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
/* $Id$ */
+
//_________________________________________________________________________
// Implementation version v0 of PHOS Manager class
// Layout EMC + PPSD has name GPS2
#include "TGeometry.h"
#include "TFolder.h"
#include "TROOT.h"
+#include "TTree.h"
// --- Standard library ---
#include "AliConst.h"
#include "AliMC.h"
#include "AliPHOSGeometry.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSv0)
// MIXT = 4 modules (EMC + CPV) and 1 module (EMC + PPSD)
// create the geometry parameters object
- // it will posted to a folder
-
- if (strcmp(GetTitle(),"") != 0 )
- fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ;
+ // and post it to a folder (Post retrieves the correct geometry)
+ AliPHOSGetter::GetInstance(gDirectory->GetName(), 0)->Post(gDirectory->GetName(), "G") ;
}
// inside bottom micromegas
micro2node->cd() ;
// a. top lid
+
y = ( geom->GetMicromegas2Thickness() - geom->GetLidThickness() ) / 2. ;
sprintf(nodename, "%s%d%d%d", "Lidb", i, iphi, iz) ;
+
TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
toplidbnode->SetLineColor(kColorPPSD) ;
fNodes->Add(toplidbnode) ;
// b. composite panel
+
y = y - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ;
sprintf(nodename, "%s%d%d%d", "CompUb", i, iphi, iz) ;
+
TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
compupbnode->SetLineColor(kColorPPSD) ;
fNodes->Add(compupbnode) ;
// c. anode
+
y = y - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness() / 2. ;
sprintf(nodename, "%s%d%d%d", "Anob", i, iphi, iz) ;
+
TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
anodebnode->SetLineColor(kColorPPSD) ;
fNodes->Add(anodebnode) ;
// d. conversion gas
+
y = y - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. ;
sprintf(nodename, "%s%d%d%d", "GGapb", i, iphi, iz) ;
+
TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
ggapbnode->SetLineColor(kColorGas) ;
fNodes->Add(ggapbnode) ;
// f. cathode
+
y = y - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness() / 2. ;
sprintf(nodename, "%s%d%d%d", "Cathodeb", i, iphi, iz) ;
+
TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
cathodebnode->SetLineColor(kColorPPSD) ;
fNodes->Add(cathodebnode) ;
}
}
+
((AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i])->AddChecker(bhmc) ;
((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i])->AddChecker(bemc) ;
}
+
}
//____________________________________________________________________________
delete fHits ;
fHits = 0 ;
}
+ if (fTreeQA)
+ delete fTreeQA ;
}
//____________________________________________________________________________
//____________________________________________________________________________
void AliPHOSv1::StepManager(void)
{
+
// Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
Int_t relid[4] ; // (box, layer, row, column) indices
#include "AliPHOSFastRecParticle.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSv4.h"
+#include "AliPHOSGetter.h"
#include "AliRun.h"
#include "AliConst.h"
#include "AliMC.h"
{
// ctor
- // gets an instance of the geometry parameters class
- if (strcmp(GetTitle(),"") != 0 )
- fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ;
-
+
+ // create the geometry parameters object
+ // and post it to a folder (Post retrieves the correct geometry)
+ AliPHOSGetter::GetInstance(gDirectory->GetName(), 0)->Post(gDirectory->GetName(), "G") ;
SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ;
SetBigBox(1, GetGeometry()->GetOuterBoxSize(1) + GetGeometry()->GetCPVBoxSize(1) ) ;