#include <Riostream.h>
#include "AliMpIntPair.h"
-#include "AliMpPlaneSegmentation.h"
+#include "AliMpSectorSegmentation.h"
#include "AliMpPad.h"
#include "AliMpMotifMap.h"
#include "AliMpSector.h"
-#include "AliMpPlane.h"
#include "AliMpZone.h"
#include "AliMpSubZone.h"
#include "AliMpVRowSegment.h"
#include "AliMUONSt1IniReader.h"
#include "AliMUONSt1Decoder.h"
#include "AliMUONTransientDigit.h"
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONSt12QuadrantSegmentation.h"
+#include "AliMUONChamber.h"
#include "AliLog.h"
ClassImp(AliMUONSt1Response)
//__________________________________________________________________________
-AliMUONSt1Response::AliMUONSt1Response(Int_t chamber)
+AliMUONSt1Response::AliMUONSt1Response(AliMUONChamber* chamber)
: AliMUONResponseV0(),
+ fReadFiles(kTRUE),
fCountNofCalls(0),
fCountUnknownZone(0),
fCountUnknownIndices(0),
Int_t i;
for (i=0;i<2;i++){
fIniFileName[i]="";
- fPlane[0]=0;
- fPlaneSegmentation[i]=0;
+ for (Int_t j=0;j<fgkNofZones;j++)
+ {
+ fDefaultParameters[i][j]=0;
+ }
+ }
+ fTrashList.SetOwner(kTRUE);
+}
+
+
+//__________________________________________________________________________
+AliMUONSt1Response::AliMUONSt1Response()
+ : AliMUONResponseV0(),
+ fReadFiles(kTRUE),
+ fCountNofCalls(0),
+ fCountUnknownZone(0),
+ fCountUnknownIndices(0),
+ fChamber(0),
+ fParams(),
+ fRegions(),
+ fTrashList()
+
+{
+// Standard constructor
+
+ Int_t i;
+ for (i=0;i<2;i++){
+ fIniFileName[i]="";
for (Int_t j=0;j<fgkNofZones;j++)
{
fDefaultParameters[i][j]=0;
//destructor
Int_t i;
for (i=0;i<2;i++){
- if (fPlaneSegmentation[i]) delete fPlaneSegmentation[i];
- if (fPlane[i]) delete fPlane[i];
fTrashList.Delete();
}
}
}
+//__________________________________________________________________________
+const AliMUONGeometrySegmentation*
+AliMUONSt1Response::GetGeometrySegmentation(Int_t cathod)
+{
+// Get geometry segmentation for given cathod plane
+
+ if (!fChamber->SegmentationModel2(cathod))
+ AliFatal(Form("Geometry segmentation for cathod %d not defined.", cathod));
+
+ return fChamber->SegmentationModel2(cathod);
+}
+
+//__________________________________________________________________________
+const AliMpSectorSegmentation*
+AliMUONSt1Response::GetMpSegmentation(Int_t detElemId, Int_t cathod)
+{
+// Get mapping segmentation for given detection elemnt
+
+ const AliMUONVGeometryDESegmentation* deSegmentation
+ = GetGeometrySegmentation(cathod)->GetDESegmentation(detElemId);
+
+ if (!deSegmentation) {
+ AliFatal(Form("DE segmentation for detElemId= %d not defined.",
+ detElemId));
+ }
+
+ const AliMUONSt12QuadrantSegmentation* quadrantSegmentation
+ = static_cast<const AliMUONSt12QuadrantSegmentation*>(deSegmentation);
+
+ return quadrantSegmentation->GetMpSegmentation();
+}
+
+
//__________________________________________________________________________
void AliMUONSt1Response::ReadCouplesOfIntRanges(const string& value,
TList* list,
{
//Read the ini file and fill the <plane>th structures
+ cout << "ReadIniFile now ..." << endl;
+
TString path = fgkTopDir + fgkDataDir ;
//read .ini file
if (gSystem->AccessPathName(path+fIniFileName[plane],kReadPermission)){
}
}
//book memory and fill them with .ini files
- fPlane[0]=AliMpPlane::Create(kStation1, kBendingPlane);
- fPlane[1]=AliMpPlane::Create(kStation1, kNonBendingPlane);
for (i=0;i<2;i++){
- fPlaneSegmentation[i]= new AliMpPlaneSegmentation(fPlane[i]);
ReadIniFile(i);
}
+
+ fReadFiles = kFALSE;
}
//__________________________________________________________________________
//__________________________________________________________________________
-AliMpZone* AliMUONSt1Response::FindZone(AliMpSector* sector, Int_t posId) const
+AliMpZone* AliMUONSt1Response::FindZone(const AliMpSector* sector, Int_t posId) const
{
// to be moved to AliMpSector::
// <<" on plane "<<where->Cathode()<<endl;
//read the files the first time this function is called
- if (!fPlane[0]) ReadFiles();
+ if (fReadFiles) ReadFiles();
fCountNofCalls++;
+ const AliMpSectorSegmentation* segmentation
+ = GetMpSegmentation(where->DetElemId(), where->Cathode());
+ const AliMpSector* sector = segmentation->GetSector();
+
AliMpIntPair indices(where->PadX(),where->PadY());
- AliMpPad pad = fPlaneSegmentation[where->Cathode()]->PadByIndices(indices,kFALSE);
+ AliMpPad pad = segmentation->PadByIndices(indices,kFALSE);
Int_t gc=0;
Int_t numZone=0;
AliMpZone* zone=0;
+ cout << "Digit: DE=" << where->DetElemId()
+ << " cathod=" << where->Cathode() << endl;
+ cout << "Found pad: " << pad << endl;
if (pad.IsValid()) {
AliMpIntPair location = pad.GetLocation();
//cout<<location.GetFirst()<<endl;
Int_t posId=abs(location.GetFirst());
+/*
AliMpSector* sector=0;
if (fPlane[0]->GetFrontSector()->GetMotifMap()->FindMotifPosition(posId))
sector=(AliMpSector*)fPlane[0]->GetFrontSector();
else if (fPlane[0]->GetBackSector()->GetMotifMap()->FindMotifPosition(posId))
sector=(AliMpSector*)fPlane[0]->GetBackSector();
-
+*/
if (sector) zone=FindZone(sector,posId);
if (zone){
numZone=zone->GetID()-1;
fCountUnknownIndices++;
}
+ cout << "Zone: " << zone << endl;
+
if (!zone) {
cout<<"Probleme electronic of pad "<<where->PadX()<<' '<<where->PadY()
<<" on plane "<<where->Cathode()<<endl;
return 6666;
}
+ cout << "Loop1: " << endl;
TList listParams;
- TIter next(&fRulesList[where->Cathode()]);
+ TIter next(&fRulesList[where->Cathode()-1]);
AliMUONSt1ResponseRule* rule;
while ( (rule = static_cast<AliMUONSt1ResponseRule*>(next())))
if (rule->Contains(pad)) listParams.AddAll(rule->GetParameters());
- if (fDefaultParameters[where->Cathode()][numZone])
- listParams.Add(fDefaultParameters[where->Cathode()][numZone]);
+ if (fDefaultParameters[where->Cathode()-1][numZone])
+ listParams.Add(fDefaultParameters[where->Cathode()-1][numZone]);
+ cout << "Loop2: " << endl;
AliMUONSt1ResponseParameter* param;
TIter nextParam(&listParams);
while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
return 0;
}
}
+ cout << "Loop3: " << endl;
nextParam.Reset();
while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
if (param->HasPedestal()) {
#include "AliMUONResponseV0.h"
#include "AliMUONSt1ElectronicElement.h"
-class AliMpPlane;
-class AliMpPlaneSegmentation;
+class AliMpSector;
+class AliMpSectorSegmentation;
class AliMpZone;
class AliMpSector;
class TArrayF;
class TObjArray;
class AliMUONSt1ResponseParameter;
+class AliMUONChamber;
class AliMUONSt1Response : public AliMUONResponseV0
{
public:
- AliMUONSt1Response(Int_t chamber=1);
+ AliMUONSt1Response(AliMUONChamber* chamber);
+ AliMUONSt1Response();
virtual ~AliMUONSt1Response();
//
typedef map<string, TList*> ListMap;
// private methods
- AliMpZone* FindZone(AliMpSector* sector,Int_t posId) const; // to be moved in AliMpSector::
+ const AliMUONGeometrySegmentation* GetGeometrySegmentation(Int_t cathod);
+ const AliMpSectorSegmentation* GetMpSegmentation(Int_t detElemId, Int_t cathod);
+ const AliMpSector* GetMpSector(Int_t detElemId, Int_t cathod);
+ AliMpZone* FindZone(const AliMpSector* sector,Int_t posId) const; // to be moved in AliMpSector::
void ReadFiles();
void ReadIniFile(Int_t plane,const TString& fileName,Bool_t rdParam,Bool_t rdRegion,Bool_t rdRule);
void ReadIniFile(Int_t plane);
static const TString fgkNofSigmaName ; // nof sigma name
// data members
- AliMpPlane* fPlane[2]; // !The mapping planes
- AliMpPlaneSegmentation* fPlaneSegmentation[2]; // !The mapping plane segmentation
TString fIniFileName[2];// file names for initialisation of each cathode
-
+ Bool_t fReadFiles; // flag to read initalization files only once
+
AliMUONSt1ResponseParameter* fDefaultParameters[2][fgkNofZones]; // !Response for each zone
TList fRulesList[2]; //! list of special rules
Int_t fCountUnknownZone; // ntimes the DigitResponse was called in an unknown zone
Int_t fCountUnknownIndices; // ntimes the DigitResponse was called with unknown indices
- Int_t fChamber; // The chamber number
+ AliMUONChamber* fChamber; // The MUON chamber
ParamsMap fParams; //! internal parameter list
ListMap fRegions; //! internal list of regions