#include <TClonesArray.h>
#include <TRandom.h>
#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
#include "AliMUONv1.h"
#include "AliConst.h"
#include "AliMUONHit.h"
#include "AliMUONTriggerCircuit.h"
#include "AliMUONGeometryBuilder.h"
+#include "AliMUONGeometrySVMap.h"
#include "AliMagF.h"
#include "AliRun.h"
#include "AliMC.h"
fGeometryBuilder->CreateMaterials();
}
+#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryTransformStore.h"
//___________________________________________
void AliMUONv1::Init()
{
}
if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
//cp
+
+ //
+ // Debug info
+ //
+ if (GetDebug() >1) {
+ // Print transformations and SV map
+ for (i=0; i<AliMUONConstants::NCh(); i++) {
+
+ cout << "Chamber: " << i+1 << endl;
+ cout << "===================" << endl;
+
+ Chamber(i).GetGeometry()
+ ->GetTransformStore()->Print("");
+
+ Chamber(i).GetGeometry()
+ ->GetSVMap()->Print("");
+ }
+ cout << endl;
+ }
}
//__________________________________________________________________
return 0;
}
+
+//_______________________________________________________________________________
+TString AliMUONv1::CurrentVolumePath() const
+{
+// Returns current volume path
+// (Could be removed when this function is available via gMC)
+// ---
+
+ TString path = "";
+ TString name;
+ Int_t copyNo;
+ Int_t imother = 0;
+ do {
+ name = gMC->CurrentVolOffName(imother);
+ gMC->CurrentVolOffID(imother++, copyNo);
+ TString add = "/";
+ add += name;
+ add += ".";
+ add += copyNo;
+ path.Insert(0,add);
+ }
+ while ( name != TString("ALIC") );
+
+ return path;
+}
+
//_______________________________________________________________________________
void AliMUONv1::StepManager()
{
}
// Only charged tracks
- if( !(gMC->TrackCharge()) ) return;
+ if( !(gMC->TrackCharge()) && !(gMC->TrackPid()==0) ) return;
// Only charged tracks
// Only gas gap inside chamber
idvol = iChamber -1;
if (idvol == -1) return;
+
+ if (GetDebug() > 1) {
+ // Fill the global position of detection elements
+ // Only for verification
+ AliMUONGeometrySVMap* svMap
+ = Chamber(iChamber-1).GetGeometry()->GetSVMap();
+ Double_t x, y, z;
+ gMC->TrackPosition(x, y, z);
+ svMap->AddPosition(CurrentVolumePath(), TGeoTranslation(x, y, z));
+ }
+
+ if (gMC->TrackPid()==0) return;
// Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )
// if (GetDebug()) {
// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
-// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());
-// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
+// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
// gMC->TrackPosition(fTrackPosition);
// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
// }
}
}
+ // Detection elements ids
+ AliMUONGeometryTransformStore* transforms
+ = Chamber(iChamber-1).GetGeometry()->GetTransformStore();
+ const TGeoCombiTrans* kTransform
+ = transforms->FindBySensitiveVolume(CurrentVolumePath());
+
+ Int_t detElemId = 0;
+ if (kTransform) detElemId = kTransform->GetUniqueID();
+
+ if (!detElemId) {
+ cerr << "Chamber id: "
+ << setw(3) << iChamber << " "
+ << "Current SV: "
+ << CurrentVolumePath()
+ << " detElemId: "
+ << setw(5) << detElemId
+ << endl;
+ Double_t x, y, z;
+ gMC->TrackPosition(x, y, z);
+ cerr << " global position: "
+ << x << ", " << y << ", " << z
+ << endl;
+ Warning("StepManager", "DetElemId not identified.");
+ }
+
// One hit per chamber
GetMUONData()->AddHit(fIshunt,
gAlice->GetMCApp()->GetCurrentTrackNumber(),
tlength += step ;
}
}
+
+//______________________________________________________________________________
+void AliMUONv1::FinishRun()
+{
+// Print debug info
+// ---
+
+ if (GetDebug() <= 1) return;
+
+ // Print the global positions of detection elements
+ for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
+
+ cout << "Chamber: " << i+1 << endl;
+ cout << "===================" << endl;
+
+ AliMUONGeometrySVMap* svMap
+ = Chamber(i).GetGeometry()->GetSVMap();
+
+ svMap->SortPositions();
+ svMap->PrintPositions();
+ svMap->ClearPositions();
+ }
+ cout << endl;
+}
virtual void Init();
virtual Int_t IsVersion() const {return 1;}
virtual void StepManager();
+ virtual void FinishRun();
void StepManagerOld();
void SetStepManagerVersionOld(Bool_t Opt)
{ fStepManagerVersionOld = Opt; }
AliMUONv1& operator = (const AliMUONv1& right);
virtual Int_t GetChamberId(Int_t volId) const;
+ TString CurrentVolumePath() const;
Bool_t fStepManagerVersionOld; // Version of StepManager, Default is false
Bool_t fAngleEffect; // Angle Effect along wires, Default is true
TF1 * fAngleEffect10; // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
TF1 * fAngleEffectNorma;// Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)
- private:
- // method
- void PlaceVolume(const TString& name, const TString& mName, Int_t copyNo,
- const TGeoHMatrix& matrix, Int_t npar, Double_t* param,
- const char* only) const;
-
- ClassDef(AliMUONv1,2) // MUON Detector class Version 1
-
-
+ ClassDef(AliMUONv1,3) // MUON Detector class Version 1
};
#endif