There are a few things which are common across several analysis which we would like to share or discuss.
Selection of Types of Diffractive Events
When running on simulated data, one may wish to know whether an event is non-diffractive, single-diffractive, double-diffractive or even possibly centrally-diffractive. In Alice data, the generator used is typically either Phojet or Pythia (6 or 8) for proton-proton collisions. These generators have stored the event type in each event, accessible through the event header. It can be read using the following code:
First, we need access to the event generator headers.
AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(mcEvent->GenEventHeader());
AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(mcEvent->GenEventHeader());
Then, depending on which event header object exists (and therefore which generator created the simulated event) we determine the event type using the event type codes individual to the generator.
Int_t processType=0;
Int_t SD1flag,SD2flag,DDflag,CDflag,ELflag,NDflag;
if(pythiaGenHeader) { //pythia6
processType = pythiaGenHeader->ProcessType();
SD1flag = 92; // single diffractive (one side)
SD2flag = 93; // single diffractive (other side)
DDflag = 94; // double diffractive
ELflag = 91; // elastic
CDflag = -2; // central diffractive
NDflag = -1; // non siffractive
Printf("Pythia event %i\n", processType);
}
else {
processType = dpmHeader->ProcessType();
SD1flag = 5;
SD2flag = 6;
CDflag = 4;
DDflag = 7;
ELflag = 2;
NDflag = 1;
Printf("Phojet event %i\n", processType);
}
From this one can construct a selection for non single diffractive event types.
Compiling root macros with gcc (without root)
A compiled macro runs a lot quicker than one run in interpreted mode in root. One may want to compile the macro so that it runs without root, being a standalone executable which uses root libraries. This requires that the macro includes all the header files from root it will need. Then, one can define a file called "doroot" with the following content:
set -x
g++ -O2 -pipe -Wall -W -Woverloaded-virtual -fPIC -Iinclude -pthread -I $ROOTSYS/include -o $1.o -c $1.cxx
g++ -O2 $1.o -L$ROOTSYS/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathcore -lThread -pthread -lm -ldl -o $1
Make this "doroot" file executable with
chmod +x doroot
and place it in a directory which is seen by the $PATH variable. Then one can simply compile a root macro with
doroot macro
as the command automatically looks for the file "macro.cxx" when the argument is "macro".
Primary track selection in MC
Basically one would like a way to select in the Monte Carlo the final-state long-lived particles coming from the interation vertex and remove any others eg intermediate particles which the generator kept track of (q,g), weak decay daughters, products of secondary interactions. There are (at least) two ways to do this using only methods from
AliRoot? .
Both methods require that your analysis task obtains a pointer both the the
AliMCEvent? and
AliStack? objects. Eg
AliMCEvent* mcEvent = MCEvent();
AliStack* stack = mcEvent->Stack();
One should then begin a loop over the MC tracks
Int_t nPrim = stack->GetNprimary();
for (Int_t iMc = 0; iMc < nPrim; ++iMc)
{
...
}
Inside this loop you have the choice of doing
one of the following
if (stack->IsPhysicalPrimary(iMc)){ TParticle* particle = stack->Particle(iMc); TParticlePDG* partPDG = particle->GetPDG(); if (partPDG->Charge()!=0) { fHistEtaMC->Fill(particle->Eta()); } }
or
if (AliPWG0Helper::IsPrimaryCharged(particle,nPrim,kFALSE)) { fHistEtaMC->Fill(particle->Eta()); }
The above examples are not complete, they just fill a simple η histogram (if you try both together remember to change the name of the second histogram). All of the methods used have online documentation.
AliPWG0Helper::IsPrimaryCharged()
AliStack::IsPhysicalPrimary()
Pros and cons. The
AliPWG0Helper? method needs fewer lines of user code but requires the PWG0base par file in order to run on CAF. The
AliStack? method needs more user coding, including retrieval of TParticle and
TParticlePDG? objects, but works from the standard par file AF-v4-16. I have checked that the methods select the same number of tracks for 200000 events from LHC09a4 production on CAF (over 10^7 particles).
--
LeeBarnby - 16 Mar 2009