* provided "as is" without express or implied warranty. *
**************************************************************************/
+
/* $Id$ */
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.24 2006/11/14 17:11:15 hristov
+ * Removing inheritances from TAttLine, TAttMarker and AliRndm in AliModule. The copy constructor and assignment operators are moved to the private part of the class and not implemented. The corresponding changes are propagated to the detectors
+ *
+ * Revision 1.23 2006/09/13 07:31:01 kharlov
+ * Effective C++ corrections (T.Pocheptsov)
+ *
+ * Revision 1.22 2005/06/17 07:39:07 hristov
+ * Removing GetDebug and SetDebug from AliRun and AliModule. Using AliLog for the messages
+ *
+ * Revision 1.21 2005/05/28 14:19:05 schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
//_________________________________________________________________________
// Implementation version vImpacts of PHOS Manager class.
// This class inherits from v1 and adds impacts storing.
// --- ROOT system ---
-#include "TTree.h"
+//#include <TTree.h>
+#include <TClonesArray.h>
+#include <TVirtualMC.h>
+#include <TTree.h>
// --- Standard library ---
// --- AliRoot header files ---
-#include "AliRun.h"
-#include "AliMC.h"
-#include "AliPHOSvImpacts.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSImpact.h"
+#include "AliPHOSvImpacts.h"
+#include "AliRun.h"
+#include "AliLoader.h"
+#include "AliMC.h"
+#include "AliLog.h"
ClassImp(AliPHOSvImpacts)
//____________________________________________________________________________
-AliPHOSvImpacts::AliPHOSvImpacts()
+AliPHOSvImpacts::AliPHOSvImpacts():
+ fEMCImpacts(new TList),
+ fCPVImpacts(new TList),
+ fPPSDImpacts(new TList),
+ fNEMCImpacts(),
+ fNCPVImpacts(),
+ fNPPSDImpacts()
{
// ctor
}
//____________________________________________________________________________
AliPHOSvImpacts::AliPHOSvImpacts(const char *name, const char *title):
-AliPHOSv1(name,title)
+ AliPHOSv1(name,title),
+ fEMCImpacts(new TList),
+ fCPVImpacts(new TList),
+ fPPSDImpacts(0),
+ fNEMCImpacts(),
+ fNCPVImpacts(),
+ fNPPSDImpacts()
{
// ctor : title is used to identify the layout
- // GPS2 = 5 modules (EMC + PPSD)
- // IHEP = 5 modules (EMC + CPV )
- // MIXT = 4 modules (EMC + CPV ) and 1 module (EMC + PPSD)
//
// We store hits :
// - fHits (the "normal" one), which retains the hits associated with
// This part inherits from AliPHOSv1
//
// We store impacts :
- // - fEMCImpacts, fCPVImpacts, fPPSDImpacts which are
- // TList of EMC, CPV and PPSD modules respectively, each
+ // - fEMCImpacts, fCPVImpacts which are
+ // TList of EMC and CPV modules respectively, each
// modules contains TClonesArray of AliPHOSImpacts
-
- fEMCImpacts = new TList();
- fCPVImpacts = new TList();
- fPPSDImpacts = new TList();
Int_t nPHOSModules = GetGeometry()->GetNModules();
- Int_t nCPVModules = GetGeometry()->GetNCPVModules();
- Int_t nPPSDModules = GetGeometry()->GetNPPSDModules();
+ Int_t nCPVModules = GetGeometry()->GetNModules();
Int_t iPHOSModule;
TClonesArray * impacts;
for (iPHOSModule=0; iPHOSModule<nPHOSModules; iPHOSModule++) {
fEMCImpacts->Add(new TClonesArray("AliPHOSImpact",200)) ;
fNEMCImpacts[iPHOSModule] = 0;
- impacts = (TClonesArray *)fEMCImpacts->At(iPHOSModule);
+ impacts = dynamic_cast<TClonesArray *>(fEMCImpacts->At(iPHOSModule));
}
for (iPHOSModule=0; iPHOSModule<nCPVModules; iPHOSModule++) {
fCPVImpacts->Add(new TClonesArray("AliPHOSImpact",200)) ;
fNCPVImpacts[iPHOSModule] = 0;
- impacts = (TClonesArray *)fCPVImpacts->At(iPHOSModule);
- }
- for (iPHOSModule=0; iPHOSModule<nPPSDModules; iPHOSModule++) {
- fPPSDImpacts->Add(new TClonesArray("AliPHOSImpact",200)) ;
- fNPPSDImpacts[iPHOSModule] = 0;
- impacts = (TClonesArray *)fPPSDImpacts->At(iPHOSModule);
+ impacts = dynamic_cast<TClonesArray *>(fCPVImpacts->At(iPHOSModule));
}
}
fHits = 0 ;
}
- // Delete impacts in EMC, CPV and PPSD
+ // Delete impacts in EMC, CPV
if ( fEMCImpacts ) {
fEMCImpacts->Delete() ;
delete fEMCImpacts ;
delete fCPVImpacts ;
fCPVImpacts = 0 ;
}
- if ( fPPSDImpacts ) {
- fPPSDImpacts->Delete() ;
- delete fPPSDImpacts ;
- fPPSDImpacts = 0 ;
- }
}
//____________________________________________________________________________
-void AliPHOSvImpacts::AddImpact( char* det, Int_t shunt, Int_t primary, Int_t track, Int_t module,
+void AliPHOSvImpacts::AddImpact(const char* det, Int_t shunt, Int_t primary, Int_t track, Int_t module,
Int_t pid, TLorentzVector p, Float_t *xyz)
{
// Add an impact to the impact list.
Int_t nImpacts = 0;
if (strcmp(det,"EMC ")==0) {
- impacts = (TClonesArray *)fEMCImpacts->At(module);
+ impacts = dynamic_cast<TClonesArray *>(fEMCImpacts->At(module));
nImpacts= fNEMCImpacts[module];
fNEMCImpacts[module]++ ;
}
else if (strcmp(det,"CPV ")==0) {
- impacts = (TClonesArray *)fCPVImpacts->At(module);
+ impacts = dynamic_cast<TClonesArray *>(fCPVImpacts->At(module));
nImpacts= fNCPVImpacts[module];
fNCPVImpacts[module]++ ;
}
- else if (strcmp(det,"PPSD")==0) {
- impacts = (TClonesArray *)fPPSDImpacts->At(module);
- nImpacts= fNPPSDImpacts[module];
- fNPPSDImpacts[module]++ ;
- }
+ else
+ AliFatal(Form("Wrong PHOS configuration: det=%s",det));
new((*impacts)[nImpacts]) AliPHOSImpact(shunt,primary,track,pid,p,xyz) ;
- if (fDebug==1) {
- printf("Module %d %s: ",module,det);
- ((AliPHOSImpact*)(impacts->At(nImpacts)))->Print();
- }
+ AliDebugClass(1,Form("Module %d %s: ",module,det));
+ if (AliLog::GetGlobalDebugLevel()>0)
+ (static_cast<AliPHOSImpact*>((impacts->At(nImpacts))))->Print();
}
//____________________________________________________________________________
-void AliPHOSvImpacts::MakeBranch(Option_t *opt, const char *file)
+void AliPHOSvImpacts::MakeBranch(Option_t *opt)
{
// Create new branch in the current Hits Root Tree containing
// a list of PHOS impacts (exact values of track coming to detector)
- AliDetector::MakeBranch(opt,file);
+ AliDetector::MakeBranch(opt);
Int_t bufferSize = 32000 ;
Int_t splitlevel = 0 ;
- gAlice->TreeH()->Branch("PHOSEmcImpacts" , "TList", &fEMCImpacts , bufferSize, splitlevel);
- gAlice->TreeH()->Branch("PHOSCpvImpacts" , "TList", &fCPVImpacts , bufferSize, splitlevel);
- gAlice->TreeH()->Branch("PHOSPpsdImpacts", "TList", &fPPSDImpacts, bufferSize, splitlevel);
+ fLoader->TreeH()->Branch("PHOSEmcImpacts" , "TList", &fEMCImpacts , bufferSize, splitlevel);
+ fLoader->TreeH()->Branch("PHOSCpvImpacts" , "TList", &fCPVImpacts , bufferSize, splitlevel);
}
Int_t i;
for (i=0; i<GetGeometry()->GetNModules(); i++) {
- ((TClonesArray*)fEMCImpacts->At(i)) -> Clear();
+ (static_cast<TClonesArray*>(fEMCImpacts->At(i))) -> Clear();
fNEMCImpacts[i] = 0 ;
}
- if ( strcmp(GetGeometry()->GetName(),"IHEP") == 0 || strcmp(GetGeometry()->GetName(),"MIXT") == 0 ) {
- for (i=0; i<GetGeometry()->GetNCPVModules(); i++) {
- ((TClonesArray*)fCPVImpacts->At(i)) -> Clear();
- fNCPVImpacts[i] = 0 ;
- }
- }
-
- if ( strcmp(GetGeometry()->GetName(),"GPS2") == 0 || strcmp(GetGeometry()->GetName(),"MIXT") == 0 ) {
- for (i=0; i<GetGeometry()->GetNPPSDModules(); i++) {
- ((TClonesArray*)fPPSDImpacts->At(i)) -> Clear();
- fNPPSDImpacts[i] = 0 ;
- }
+ for (i=0; i<GetGeometry()->GetNModules(); i++) {
+ (static_cast<TClonesArray*>(fCPVImpacts->At(i))) -> Clear();
+ fNCPVImpacts[i] = 0 ;
}
}
//_____________________________________________________________________________
void AliPHOSvImpacts::StepManager(void)
{
- // Find impacts (tracks which enter the EMC, CPV or PPSD)
+ // Find impacts (tracks which enter the EMC, CPV)
// and add them to to the impact lists
AliPHOSv1::StepManager();
TLorentzVector pos ; // Lorentz vector of the track current position
Int_t copy ;
- Int_t tracknumber = gAlice->CurrentTrack() ;
- Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
+ Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber() ;
+ Int_t primary = gAlice->GetMCApp()->GetPrimary( gAlice->GetMCApp()->GetCurrentTrackNumber() );
TString name = GetGeometry()->GetName() ;
// Add impact to EMC
- if( gMC->CurrentVolID(copy) == gMC->VolId("PXTL") &&
+ static Int_t idPXTL = gMC->VolId("PXTL");
+ if( gMC->CurrentVolID(copy) == idPXTL &&
gMC->IsTrackEntering() ) {
gMC->TrackMomentum(pmom);
gMC->TrackPosition(pos) ;
gMC -> Gmtod (pm, pd, 2); // transform 3-momentum from master to daughter system
// Select tracks coming to the crystal from up or down sides
- if (pd[1]<0 && xyzd[1] > GetGeometry()->GetCrystalSize(1)/2-0.001 ||
- pd[1]>0 && xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2+0.001) {
+ if ((pd[1]<0 && xyzd[1] > GetGeometry()->GetCrystalSize(1)/2-0.1) ||
+ (pd[1]>0 && xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2+0.1)) {
+ // Select tracks coming to the crystal from up or down sides
Int_t pid = gMC->TrackPid();
Int_t module;
gMC->CurrentVolOffID(10,module);
- if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
- module += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
module--;
AddImpact("EMC ",fIshunt, primary,tracknumber, module, pid, pmom, xyzm);
}
// Add impact to CPV
- if( (name == "IHEP" || name == "MIXT") &&
- gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
+ static Int_t idPCPQ = gMC->VolId("PCPQ");
+ if( gMC->CurrentVolID(copy) == idPCPQ &&
gMC->IsTrackEntering() ) {
gMC->TrackMomentum(pmom);
gMC->TrackPosition(pos) ;
module--;
AddImpact("CPV ",fIshunt, primary,tracknumber, module, pid, pmom, xyzm);
}
-
- // Add impact to PPSD
-
- if( (name == "GPS2" || name == "MIXT") &&
- gMC->CurrentVolID(copy) == gMC->VolId("PPCE") &&
- gMC->IsTrackEntering() ) {
- gMC->TrackMomentum(pmom);
- gMC->TrackPosition(pos) ;
-
- Int_t i;
- for (i=0; i<3; i++) xyzm[i] = pos[i];
-
- for (i=0; i<3; i++) {
- xyzm[i] = pos[i] ;
- pm[i] = pmom[i];
- }
- gMC -> Gmtod (xyzm, xyzd, 1); // transform coordinate from master to daughter system
- gMC -> Gmtod (pm, pd, 2); // transform 3-momentum from master to daughter system
-
- // Select tracks coming to the crystal from up or down sides
- if (pd[1]<0 && xyzd[1] > (GetGeometry()->GetConversionGap() + GetGeometry()->GetAvalancheGap())/2-0.001 ||
- pd[1]>0 && xyzd[1] < -(GetGeometry()->GetConversionGap() + GetGeometry()->GetAvalancheGap())/2+0.001) {
- Int_t pid = gMC->TrackPid();
- Int_t module;
- gMC->CurrentVolOffID(5,module);
- module--;
- AddImpact("PPSD",fIshunt, primary,tracknumber, module, pid, pmom, xyzm);
- }
- }
+
}