//-----------------------------------------------------//
#include <Riostream.h>
+#include <TMath.h>
#include <TBRIK.h>
#include <TNode.h>
#include <TTree.h>
ClassImp(AliPMDClusterFinder)
-//
-// Constructor
-//
+
AliPMDClusterFinder::AliPMDClusterFinder()
{
+//
+// Default Constructor
+//
if (!fRecpoints) fRecpoints = new TClonesArray("AliPMDrecpoint1", 1000);
fNpoint = 0;
}
AliPMDClusterFinder::~AliPMDClusterFinder()
{
+ // Destructor
delete fRecpoints;
}
-//
-// Member functions
-//
+
void AliPMDClusterFinder::OpengAliceFile(Char_t *file, Option_t *option)
{
-
+ // Loads galice.root file and corresponding header, kinematics
+ // hits and sdigits or digits depending on the option
+ //
fRunLoader = AliRunLoader::Open(file,AliConfig::fgkDefaultEventFolderName,
"UPDATE");
printf("<AliPMDdigitizer::Open> ");
printf("Could not find AliRun object.\n");
}
- PMD = (AliPMD*)gAlice->GetDetector("PMD");
- pmdloader = fRunLoader->GetLoader("PMDLoader");
- if (pmdloader == 0x0)
+ fPMD = (AliPMD*)gAlice->GetDetector("PMD");
+ fPMDLoader = fRunLoader->GetLoader("PMDLoader");
+ if (fPMDLoader == 0x0)
{
cerr<<"OpengAlice : Can not find PMD or PMDLoader\n";
}
if (cDR)
{
- pmdloader->LoadDigits("READ");
- pmdloader->LoadRecPoints("recreate");
+ fPMDLoader->LoadDigits("READ");
+ fPMDLoader->LoadRecPoints("recreate");
}
}
void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
{
+ // Converts digits to recpoints after running clustering
+ // algorithm on CPV plane and PREshower plane
+ //
Int_t det = 0,smn = 0;
Int_t cellno;
Int_t xpos,ypos;
fRunLoader->GetEvent(ievt);
//cout << " ***** Beginning::Digits2RecPoints *****" << endl;
- treeD = pmdloader->TreeD();
- if (treeD == 0x0)
+ fTreeD = fPMDLoader->TreeD();
+ if (fTreeD == 0x0)
{
cout << " Can not get TreeD" << endl;
}
AliPMDdigit *pmddigit;
- TBranch *branch = treeD->GetBranch("PMDDigit");
+ TBranch *branch = fTreeD->GetBranch("PMDDigit");
branch->SetAddress(&fDigits);
ResetRecpoint();
- treeR = pmdloader->TreeR();
- if (treeR == 0x0)
+ fTreeR = fPMDLoader->TreeR();
+ if (fTreeR == 0x0)
{
- pmdloader->MakeTree("R");
- treeR = pmdloader->TreeR();
+ fPMDLoader->MakeTree("R");
+ fTreeR = fPMDLoader->TreeR();
}
Int_t bufsize = 16000;
- treeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
+ fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
- Int_t nmodules = (Int_t) treeD->GetEntries();
+ Int_t nmodules = (Int_t) fTreeD->GetEntries();
for (Int_t imodule = 0; imodule < nmodules; imodule++)
{
ResetCellADC();
- treeD->GetEntry(imodule);
+ fTreeD->GetEntry(imodule);
Int_t nentries = fDigits->GetLast();
for (Int_t ient = 0; ient < nentries+1; ient++)
{
}
pmdcont->Clear();
- treeR->Fill();
+ fTreeR->Fill();
ResetRecpoint();
} // modules
ResetCellADC();
- pmdloader->WriteRecPoints("OVERWRITE");
+ fPMDLoader->WriteRecPoints("OVERWRITE");
// delete the pointers
delete pmdclust;
void AliPMDClusterFinder::AddRecPoint(Float_t *clusdata)
{
+ // Add Reconstructed points
+ //
TClonesArray &lrecpoints = *fRecpoints;
AliPMDrecpoint1 *newrecpoint;
newrecpoint = new AliPMDrecpoint1(clusdata);
}
void AliPMDClusterFinder::ResetCellADC()
{
+ // Reset the individual cell ADC value to zero
+ //
for(Int_t irow = 0; irow < fRow; irow++)
{
for(Int_t icol = 0; icol < fCol; icol++)
void AliPMDClusterFinder::ResetRecpoint()
{
+ // Clear the list of reconstructed points
fNpoint = 0;
if (fRecpoints) fRecpoints->Clear();
}
void AliPMDClusterFinder::UnLoad(Option_t *option)
{
+ // Unload all the *.root files
+ //
const char *cR = strstr(option,"R");
fRunLoader->UnloadgAlice();
if (cR)
{
- pmdloader->UnloadDigits();
+ fPMDLoader->UnloadDigits();
}
}
-#ifndef PMDClusterFinder_H
-#define PMDClusterFinder_H
+#ifndef ALIPMDCLUSTERFINDER_H
+#define ALIPMDCLUSTERFINDER_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
//-----------------------------------------------------//
// //
//-----------------------------------------------------//
-#include <Riostream.h>
-#include <stdlib.h>
-#include <math.h>
-#include <TMath.h>
-
class TClonesArray;
class TFile;
class TObjArray;
class TTree;
class TNtuple;
+class TMath;
class AliLoader;
class AliRunLoader;
class AliPMDClusterFinder
{
- protected:
- AliRunLoader *fRunLoader;
- AliRun *gAlice;
- AliDetector *PMD; /* Get pointers to Alice detectors
- and Hits containers */
- AliLoader *pmdloader;
-
- TTree *treeD;
- TTree *treeR;
-
- TClonesArray *fDigits;
- TClonesArray *fRecpoints;
-
- Int_t fNpoint;
- Int_t fDetNo;
- Int_t fDebug;
- Float_t fEcut;
-
- static const Int_t fRow = 48;
- static const Int_t fCol = 96;
- Double_t fCellADC[fRow][fCol];
public:
AliPMDClusterFinder();
virtual ~AliPMDClusterFinder();
- void OpengAliceFile(char * /* galice.root */, Option_t * /* option */);
+ void OpengAliceFile(char * file, Option_t * option);
- void Digits2RecPoints(Int_t /* ievt */);
- void SetCellEdepCut(Float_t /* ecut */);
- void SetDebug(Int_t /* idebug */);
- void AddRecPoint(Float_t * /* clusdata */);
+ void Digits2RecPoints(Int_t ievt);
+ void SetCellEdepCut(Float_t ecut);
+ void SetDebug(Int_t idebug);
+ void AddRecPoint(Float_t * clusdata);
void ResetCellADC();
void ResetRecpoint();
- void UnLoad(Option_t * /* option */);
+ void UnLoad(Option_t * option);
+
+ protected:
+ AliRunLoader *fRunLoader; // Pointer to Run Loader
+ AliRun *gAlice; // Pointer to Run
+ AliDetector *fPMD; // Pointers to Alice detectors & Hits containers
+ AliLoader *fPMDLoader; // Pointer to specific detector loader
+
+ TTree *fTreeD; // Digits tree
+ TTree *fTreeR; // Reconstructed points
+
+ TClonesArray *fDigits; // List of digits
+ TClonesArray *fRecpoints; // List of reconstructed points
+
+ Int_t fNpoint; //
+ Int_t fDetNo; // Detector Number (0:PRE, 1:CPV)
+ Int_t fDebug; // Debugging switch (0:NO, 1:YES)
+ Float_t fEcut; // Energy/ADC cut per cell
+
+ static const Int_t fRow = 48; // Total number of rows in one unitmodule
+ static const Int_t fCol = 96; // Total number of cols in one unitmodule
+ Double_t fCellADC[fRow][fCol]; // Array containing individual cell ADC
- ClassDef(AliPMDClusterFinder,2)
+ ClassDef(AliPMDClusterFinder,2) // To run PMD clustering
};
#endif
fRunLoader->LoadHeader();
fRunLoader->LoadKinematics();
- fAlice = fRunLoader->GetAliRun();
+ gAlice = fRunLoader->GetAliRun();
- if (fAlice)
+ if (gAlice)
{
printf("<AliPMDdigitizer::Open> ");
printf("AliRun object found on file.\n");
printf("Could not find AliRun object.\n");
}
- fPMD = (AliPMD*)fAlice->GetDetector("PMD");
+ fPMD = (AliPMD*)gAlice->GetDetector("PMD");
fPMDLoader = fRunLoader->GetLoader("PMDLoader");
if (fPMDLoader == 0x0)
{
Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
printf("Number of Particles = %d \n", nparticles);
fRunLoader->GetEvent(ievt);
- fPArray = fAlice->GetMCApp()->Particles();
+ fPArray = gAlice->GetMCApp()->Particles();
// ------------------------------------------------------- //
// Pointer to specific detector hits.
// Get pointers to Alice detectors and Hits containers
if (fPMD) fHits = fPMD->Hits();
// Start loop on tracks in the hits containers
-
for (Int_t track=0; track<ntracks;track++)
{
- fAlice->ResetHits();
+ gAlice->ResetHits();
fTreeH->GetEvent(track);
-
if (fPMD)
{
npmd = fHits->GetEntriesFast();
+ cout << " npmd = " << npmd << endl;
for (int ipmd = 0; ipmd < npmd; ipmd++)
{
fPMDHit = (AliPMDhit*) fHits->UncheckedAt(ipmd);
// get kinematics of the particles
- fParticle = fAlice->GetMCApp()->Particle(trackno);
+ fParticle = gAlice->GetMCApp()->Particle(trackno);
trackpid = fParticle->GetPdgCode();
+ cout << " trackno = " << trackno << " track = " << track << endl;
+ //cout << " trackpid = " << trackpid << endl;
Int_t igatr = -999;
Int_t ichtr = -999;
Int_t igapid = -999;
Int_t idmo = -999;
TParticle* mparticle = fParticle;
+ Int_t jjnu = mparticle->GetFirstMother();
+ cout << " Coming to this step - step 0 jjnu = " << jjnu << endl;
+
Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
if (mparticle->GetFirstMother() == -1)
{
trackpidOld = trackpid;
statusOld = -1;
}
-
Int_t igstatus = 0;
while((imo = mparticle->GetFirstMother()) >= 0)
{
igen++;
- mparticle = fAlice->GetMCApp()->Particle(imo);
+ mparticle = gAlice->GetMCApp()->Particle(imo);
idmo = mparticle->GetPdgCode();
vx = mparticle->Vx();
mtrackno = tracknoOld;
mtrackpid = trackpidOld;
}
-
xPos = fPMDHit->X();
yPos = fPMDHit->Y();
zPos = fPMDHit->Z();
Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
printf("Number of Particles = %d \n", nparticles);
fRunLoader->GetEvent(ievt);
- fPArray = fAlice->GetMCApp()->Particles();
+ fPArray = gAlice->GetMCApp()->Particles();
// ------------------------------------------------------- //
// Pointer to specific detector hits.
// Get pointers to Alice detectors and Hits containers
- fPMD = (AliPMD*)fAlice->GetDetector("PMD");
+ fPMD = (AliPMD*)gAlice->GetDetector("PMD");
fPMDLoader = fRunLoader->GetLoader("PMDLoader");
if (fPMDLoader == 0x0)
for (Int_t track=0; track<ntracks;track++)
{
- fAlice->ResetHits();
+ gAlice->ResetHits();
fTreeH->GetEvent(track);
if (fPMD)
// get kinematics of the particles
- fParticle = fAlice->GetMCApp()->Particle(trackno);
+ fParticle = gAlice->GetMCApp()->Particle(trackno);
trackpid = fParticle->GetPdgCode();
Int_t igatr = -999;
{
igen++;
- mparticle = fAlice->GetMCApp()->Particle(imo);
+ mparticle = gAlice->GetMCApp()->Particle(imo);
idmo = mparticle->GetPdgCode();
vx = mparticle->Vx();
protected:
AliRunLoader *fRunLoader; // Pointer to Run Loader
- AliRun *fAlice; // Pointer to a Run
+ AliRun *gAlice; // Pointer to a Run
AliPMDhit *fPMDHit; // Pointer to specific detector hits
AliDetector *fPMD; // Get pointers to Alice detectors
// and Hits containers