From a713db22a500de8b3ba697a788794540da4df231 Mon Sep 17 00:00:00 2001 From: cussonno Date: Mon, 21 Feb 2005 10:05:31 +0000 Subject: [PATCH] New segmentation with switch between old and new (Ch. Finck) --- MUON/AliMUON.cxx | 37 +- MUON/AliMUON.h | 10 +- MUON/AliMUONChamber.cxx | 377 +++++--- MUON/AliMUONChamber.h | 23 +- MUON/AliMUONClusterFinderVS.cxx | 74 +- MUON/AliMUONClusterFinderVS.h | 2 - MUON/AliMUONClusterInput.cxx | 172 +++- MUON/AliMUONClusterInput.h | 8 + MUON/AliMUONClusterReconstructor.cxx | 170 +++- MUON/AliMUONClusterReconstructor.h | 3 + MUON/AliMUONDigit.cxx | 15 +- MUON/AliMUONDigit.h | 7 +- MUON/AliMUONDigitizer.cxx | 199 ++-- MUON/AliMUONDigitizer.h | 2 + MUON/AliMUONDigitizerv1.cxx | 25 +- MUON/AliMUONDigitizerv2.cxx | 13 +- MUON/AliMUONFactory.h | 4 +- MUON/AliMUONFactoryV2.cxx | 1092 ++++++++++++++++++++++ MUON/AliMUONFactoryV2.h | 66 ++ MUON/AliMUONMathieson.cxx | 48 +- MUON/AliMUONMathieson.h | 2 + MUON/AliMUONResponse.h | 7 +- MUON/AliMUONResponseV0.cxx | 60 +- MUON/AliMUONResponseV0.h | 50 +- MUON/AliMUONSDigitizerv1.cxx | 2 +- MUON/AliMUONSt12QuadrantSegmentation.cxx | 11 + MUON/AliMUONSt345SlatSegmentation.cxx | 28 +- MUON/AliMUONSt345SlatSegmentation.h | 1 + MUON/AliMUONTriggerSegmentation.cxx | 9 +- MUON/AliMUONTriggerSegmentation.h | 1 + MUON/AliMUONv1.cxx | 66 +- MUON/Config.C | 3 +- MUON/MUONsimLinkDef.h | 1 + MUON/libMUONsim.pkg | 1 + 34 files changed, 2160 insertions(+), 429 deletions(-) create mode 100644 MUON/AliMUONFactoryV2.cxx create mode 100644 MUON/AliMUONFactoryV2.h diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx index 05e617613ab..a24b1957527 100644 --- a/MUON/AliMUON.cxx +++ b/MUON/AliMUON.cxx @@ -63,6 +63,7 @@ #include "AliMUONCommonGeometryBuilder.h" #include "AliMUONVGeometryBuilder.h" #include "AliMUONGeometryDEIndexing.h" +#include "AliMUONGeometrySegmentation.h" #include "AliMUONDigitizerv2.h" #include "AliMUONSDigitizerv1.h" #include "AliMUONRawData.h" @@ -94,6 +95,7 @@ AliMUON::AliMUON() fChambers(0), fTriggerCircuits(0), fGeometryBuilder(0), + fSegmentationType(0),// 0 for undefined fDEIndexing(0), fAccCut(kFALSE), fAccMin(0.), @@ -121,6 +123,7 @@ AliMUON::AliMUON(const char *name, const char *title) fChambers(0), fTriggerCircuits(0), fGeometryBuilder(0), + fSegmentationType(0),// 0 for undefined fDEIndexing(0), fAccCut(kFALSE), fAccMin(0.), @@ -250,12 +253,26 @@ void AliMUON::BuildGeometry() { // Geometry for event display - for (Int_t i=0; i<7; i++) { - for (Int_t j=0; j<2; j++) { - Int_t id=2*i+j+1; - this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); - } - } + if (!fSegmentationType) { + AliFatal("No Segmentation Type defined."); + return; + } + + if (fSegmentationType == 1) { + for (Int_t i=0; i<7; i++) { + for (Int_t j=0; j<2; j++) { + Int_t id=2*i+j+1; + this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); + } + } + } else { +// for (Int_t i=0; i<14; i++) { +// for (Int_t j=0; j<100; j++) { +// Int_t id= (i+1)*100 + j; +// this->Chamber(i).SegmentationModel2(1)->Draw(id,"eventdisplay");// to be check ! +// } +// } + } } //__________________________________________________________________ @@ -416,7 +433,7 @@ Float_t AliMUON::GetMaxDestepAlu() const //____________________________________________________________________ void AliMUON::SetAlign(Bool_t align) - { +{ // Sets option for alignement to geometry builder fGeometryBuilder->SetAlign(align); @@ -425,6 +442,12 @@ Float_t AliMUON::GetMaxDestepAlu() const //____________________________________________________________________ void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation) { +// Set the segmentation for chamber id cathode isec + ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation); +} +//____________________________________________________________________ +void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliMUONGeometrySegmentation* segmentation) +{ // Set the segmentation for chamber id cathode isec ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation); diff --git a/MUON/AliMUON.h b/MUON/AliMUON.h index 024e3d6ea82..c3ba1547b72 100644 --- a/MUON/AliMUON.h +++ b/MUON/AliMUON.h @@ -22,6 +22,7 @@ class TTree; class AliLoader; class AliSegmentation; +class AliMUONGeometrySegmentation; class AliMUONTriggerCircuit; class AliMUONData; class AliMUONResponse; @@ -83,6 +84,12 @@ class AliMUON : public AliDetector // Set Segmentation and Response Model virtual void SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation); + virtual void SetSegmentationModel(Int_t id, Int_t isec, + AliMUONGeometrySegmentation* segmentation); + + void SetSegmentationType(Int_t type) {fSegmentationType = type;}// 1 for old 2 for new, 0 undefined + Int_t WhichSegmentation() {return fSegmentationType; } + virtual void SetResponseModel(Int_t id, AliMUONResponse *response); virtual void SetNsec(Int_t id, Int_t nsec); @@ -133,6 +140,7 @@ class AliMUON : public AliDetector TObjArray* fChambers; // List of Tracking Chambers TObjArray* fTriggerCircuits; // List of Trigger Circuits AliMUONGeometryBuilder* fGeometryBuilder; // Geometry builder + Int_t fSegmentationType; // type for segmentation AliMUONGeometryDEIndexing* fDEIndexing; // Geometry DE indexing // @@ -152,7 +160,7 @@ class AliMUON : public AliDetector // Background eent for event mixing AliMUONMerger *fMerger; // ! pointer to merger - ClassDef(AliMUON,7) // MUON Detector base class + ClassDef(AliMUON,8) // MUON Detector base class }; #endif diff --git a/MUON/AliMUONChamber.cxx b/MUON/AliMUONChamber.cxx index 31e48dc1ed5..b868de8241b 100644 --- a/MUON/AliMUONChamber.cxx +++ b/MUON/AliMUONChamber.cxx @@ -18,10 +18,14 @@ // --- ROOT includes --- #include #include +#include "AliRun.h" + // --- MUON includes --- +#include "AliMUON.h" #include "AliMUONChamber.h" #include "AliMUONGeometryModule.h" +#include "AliMUONHit.h" #include "AliLog.h" ClassImp(AliMUONChamber) @@ -37,12 +41,15 @@ AliMUONChamber::AliMUONChamber() frMax(0.), fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called fSegmentation(0), + fSegmentation2(0), fResponse(0), - fGeometry(0) + fGeometry(0), + fMUON(0) { // Default constructor } +//_______________________________________________________ AliMUONChamber::AliMUONChamber(Int_t id) : TObject(), fId(id), @@ -54,39 +61,64 @@ AliMUONChamber::AliMUONChamber(Int_t id) frMax(0.), fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called fSegmentation(0), + fSegmentation2(0), fResponse(0), - fGeometry(0) + fGeometry(0), + fMUON(0) { + + // muon + fMUON = (AliMUON*)gAlice->GetModule("MUON"); + if (!fMUON) { + AliFatal("MUON detector not defined."); + return; + } // Construtor with chamber id fSegmentation = new TObjArray(2); fSegmentation->AddAt(0,0); fSegmentation->AddAt(0,1); - + + // new segmentation + fSegmentation2 = new TObjArray(2); + fSegmentation2->AddAt(0,0); + fSegmentation2->AddAt(0,1); + fGeometry = new AliMUONGeometryModule(fId); + } +//_______________________________________________________ AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber) : TObject(rChamber) { -// Protected copy constructor + // Protected copy constructor AliFatal("Not implemented."); - // Dummy copy constructor + // Dummy copy constructor } +//_______________________________________________________ AliMUONChamber::~AliMUONChamber() { -// Destructor - if (fSegmentation) { - fSegmentation->Delete(); - delete fSegmentation; + // Destructor + if (fMUON->WhichSegmentation() == 1) { + if (fSegmentation) { + fSegmentation->Delete(); + delete fSegmentation; + } + } else { + if (fSegmentation2) { + fSegmentation2->Delete(); + delete fSegmentation2; + } } delete fGeometry; } +//_______________________________________________________ AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs) { -// Protected assignement operator + // Protected assignement operator if (this == &rhs) return *this; @@ -95,145 +127,270 @@ AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs) return *this; } +//_______________________________________________________ Bool_t AliMUONChamber::IsSensId(Int_t volId) const { -// Returns true if the volume specified by volId is in the list -// of sesitive volumes for this chamber + // Returns true if the volume specified by volId is in the list + // of sesitive volumes for this chamber return fGeometry->IsSensitiveVolume(volId); } +//_______________________________________________________ void AliMUONChamber::Init() { -// Initalisation .. -// -// ... for chamber segmentation - //PH if ((*fSegmentation)[0]) - //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId); - if (fSegmentation->At(0)) + // Initalisation .. + // + // ... for chamber segmentation + + if (fSegmentation->At(0)) ((AliSegmentation *) fSegmentation->At(0))->Init(fId); - if (fnsec==2) { - //PH if ((*fSegmentation)[1]) - //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId); - if (fSegmentation->At(1)) - ((AliSegmentation *) fSegmentation->At(1))->Init(fId); - } + if (fnsec==2) { + if (fSegmentation->At(1)) + ((AliSegmentation *) fSegmentation->At(1))->Init(fId); + } + + } +//_________________________________________________________________ Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z) { -// Ask segmentation if signal should be generated - if (fnsec==1) { - //PH return ((AliSegmentation*) (*fSegmentation)[0]) - return ((AliSegmentation*) fSegmentation->At(0)) - ->SigGenCond(x, y, z) ; - } else { - //PH return (((AliSegmentation*) (*fSegmentation)[0]) - return (((AliSegmentation*) fSegmentation->At(0)) - ->SigGenCond(x, y, z)) || - //PH (((AliSegmentation*) (*fSegmentation)[1]) - (((AliSegmentation*) fSegmentation->At(1)) - ->SigGenCond(x, y, z)) ; - } -} + // Ask segmentation if signal should be generated + if (fnsec==1) { + return ((AliSegmentation*) fSegmentation->At(0)) + ->SigGenCond(x, y, z) ; + } else { + return (((AliSegmentation*) fSegmentation->At(0)) + ->SigGenCond(x, y, z)) || + (((AliSegmentation*) fSegmentation->At(1)) + ->SigGenCond(x, y, z)) ; + } + +} +//_________________________________________________________________ void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z) { -// -// Initialisation of segmentation for hit -// - if (fnsec==1) { - //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ; - ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ; - } else { - //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ; - //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ; - ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ; - ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ; - } + // + // Initialisation of segmentation for hit + // + + + if (fnsec==1) { + ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ; + } else { + ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ; + ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ; + } + } +//_____________________________________________________ void AliMUONChamber::ChargeCorrelationInit() { -// Initialisation of charge correlation for current hit -// the value is stored, and then used by Disintegration -if (fnsec==1) + // Initialisation of charge correlation for current hit + // the value is stored, and then used by Disintegration + if (fnsec==1) fCurrentCorrel =1; -else + else // exponential is here to avoid eventual problems in 0 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2)); } +//_______________________________________________________ void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/, Float_t xhit, Float_t yhit, Float_t zhit, Int_t& nnew,Float_t newclust[6][500]) { -// -// Generates pad hits (simulated cluster) -// using the segmentation and the response model - Float_t dx, dy; - // - // Width of the integration area - // - dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX(); - dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY(); - // - // Get pulse height from energy loss - Float_t qtot = fResponse->IntPH(eloss); - // - // Loop Over Pads + // + // Generates pad hits (simulated cluster) + // using the segmentation and the response model + Float_t dx, dy; + // + // Width of the integration area + // + dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX(); + dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY(); + // + // Get pulse height from energy loss + Float_t qtot = fResponse->IntPH(eloss); + // + // Loop Over Pads - Float_t qp; - nnew=0; + Float_t qp; + nnew=0; - // Cathode plane loop - for (Int_t i=1; i<=fnsec; i++) { - Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel); - AliSegmentation * segmentation= - //PH (AliSegmentation *) (*fSegmentation)[i-1]; - (AliSegmentation *) fSegmentation->At(i-1); - for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy); - segmentation->MorePads(); - segmentation->NextPad()) - { - qp=fResponse->IntXY(segmentation); - qp=TMath::Abs(qp); -// -// - if (qp > 1.e-4) - { - if (nnew >= 500) // Perform a bounds check on nnew since it is assumed - // newclust only contains 500 elements. - { - AliError("Limit of 500 pad responses reached."); - return; - }; - // - // --- store signal information - newclust[0][nnew]=qcath; // total charge - newclust[1][nnew]=segmentation->Ix(); // ix-position of pad - newclust[2][nnew]=segmentation->Iy(); // iy-position of pad - newclust[3][nnew]=qp * qcath; // charge on pad - newclust[4][nnew]=segmentation->ISector(); // sector id - newclust[5][nnew]=(Float_t) i; // counter - nnew++; + // Cathode plane loop + for (Int_t i=1; i<=fnsec; i++) { + Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel); + AliSegmentation* segmentation= + (AliSegmentation*) fSegmentation->At(i-1); + for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy); + segmentation->MorePads(); + segmentation->NextPad()) + { + qp=fResponse->IntXY(segmentation); + qp=TMath::Abs(qp); + // + // + if (qp > 1.e-4) + { + if (nnew >= 500) // Perform a bounds check on nnew since it is assumed + // newclust only contains 500 elements. + { + AliError("Limit of 500 pad responses reached."); + return; + }; + // + // --- store signal information + newclust[0][nnew]=qcath; // total charge + newclust[1][nnew]=segmentation->Ix(); // ix-position of pad + newclust[2][nnew]=segmentation->Iy(); // iy-position of pad + newclust[3][nnew]=qp * qcath; // charge on pad + newclust[4][nnew]=segmentation->ISector(); // sector id + newclust[5][nnew]=(Float_t) i; // counter + nnew++; - } - } // Pad loop - - } // Cathode plane loop + } + } // Pad loop + } // Cathode plane loop } +//_______________________________________________________ +void AliMUONChamber::InitGeo(Float_t /*zpos*/) +{ + // sensitive gas gap + fdGas= 0.5; + // 3% radiation length of aluminum (X0=8.9 cm) + fdAlu= 3.0/100*8.9; +} +//_______________________________________________________ +// +// NEW SEGMENTATION +//_______________________________________________________ +void AliMUONChamber::Init(Int_t flag) +{ + // Initalisation .. + // + // ... for chamber segmentation + if (!flag) AliFatal("wrong segmentation type."); -void AliMUONChamber::InitGeo(Float_t /*zpos*/) + + if (fSegmentation2->At(0)) + ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->Init(fId); + + if (fnsec==2) { + if (fSegmentation2->At(1)) + ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->Init(fId); + } +} + +//_________________________________________________________________ +Int_t AliMUONChamber::SigGenCond(AliMUONHit *hit) +{ + // Ask segmentation if signal should be generated + + Float_t x = hit->X(); + Float_t y = hit->Y(); + Float_t z = hit->Z(); + Int_t id = hit->DetElemId(); + + if (fnsec==1) { + return ((AliMUONGeometrySegmentation*)fSegmentation2->At(0))->SigGenCond(id, x, y, z); + } else { + return (((AliMUONGeometrySegmentation*) fSegmentation2->At(0)) + ->SigGenCond(id, x, y, z)) || + (((AliMUONGeometrySegmentation*) fSegmentation2->At(1)) + ->SigGenCond(id, x, y, z)) ; + } +} + +//_________________________________________________________________ +void AliMUONChamber::SigGenInit(AliMUONHit *hit) { -// sensitive gas gap - fdGas= 0.5; -// 3% radiation length of aluminum (X0=8.9 cm) - fdAlu= 3.0/100*8.9; + // + // Initialisation of segmentation for hit + // + Float_t x = hit->X(); + Float_t y = hit->Y(); + Float_t z = hit->Z(); + Int_t id = hit->DetElemId(); + + if (fnsec==1) { + ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ; + } else { + ((AliMUONGeometrySegmentation*) fSegmentation2->At(0))->SigGenInit(id, x, y, z) ; + ((AliMUONGeometrySegmentation*) fSegmentation2->At(1))->SigGenInit(id, x, y, z) ; + } } +//_______________________________________________________ +void AliMUONChamber::DisIntegration(AliMUONHit *hit, + Int_t& nnew,Float_t newclust[6][500]) +{ + // + // Generates pad hits (simulated cluster) + // using the segmentation and the response model + Float_t dx, dy; + + Float_t xhit = hit->X(); + Float_t yhit = hit->Y(); + Float_t zhit = hit->Z(); + Int_t id = hit->DetElemId(); + Float_t eloss = hit->Eloss(); + // + // Width of the integration area + // + dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX(); + dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY(); + // + // Get pulse height from energy loss + Float_t qtot = fResponse->IntPH(eloss); + // + // Loop Over Pads + + Float_t qp; + nnew=0; + + // Cathode plane loop + for (Int_t i=1; i<=fnsec; i++) { + Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel); + + AliMUONGeometrySegmentation* segmentation= + (AliMUONGeometrySegmentation*) fSegmentation2->At(i-1); + + for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy); + segmentation->MorePads(id); + segmentation->NextPad(id)) + { + qp=fResponse->IntXY(id, segmentation); + qp=TMath::Abs(qp); + // + // + if (qp > 1.e-4) + { + if (nnew >= 500) // Perform a bounds check on nnew since it is assumed + // newclust only contains 500 elements. + { + AliError("Limit of 500 pad responses reached."); + return; + }; + // + // --- store signal information + newclust[0][nnew]=qcath; // total charge + newclust[1][nnew]=segmentation->Ix(); // ix-position of pad + newclust[2][nnew]=segmentation->Iy(); // iy-position of pad + newclust[3][nnew]=qp * qcath; // charge on pad + newclust[4][nnew]=segmentation->ISector(); // sector id + newclust[5][nnew]=(Float_t) i; // counter + nnew++; + + } + } // Pad loop + } // Cathode plane loop +} diff --git a/MUON/AliMUONChamber.h b/MUON/AliMUONChamber.h index 95ed3e907f1..70f61d61b6c 100644 --- a/MUON/AliMUONChamber.h +++ b/MUON/AliMUONChamber.h @@ -11,9 +11,13 @@ #include "AliSegmentation.h" #include "AliMUONResponse.h" +#include "AliMUONGeometrySegmentation.h" class AliMUONClusterFinderVS; class AliMUONGeometryModule; +class AliMUON; +class AliMUONHit; + class AliMUONChamber : public TObject { @@ -32,6 +36,7 @@ class AliMUONChamber : public TObject // Initialisation virtual void Init(); + virtual void Init(Int_t flag); // Set z-position of chamber virtual void SetZ(Float_t Z) {fZ = Z;} // Get z-position of chamber @@ -50,8 +55,11 @@ class AliMUONChamber : public TObject virtual void SetResponseModel(AliMUONResponse* thisResponse) {fResponse=thisResponse;} // // Set segmentation model - virtual void SetSegmentationModel(Int_t i, AliSegmentation* thisSegmentation) { - fSegmentation->AddAt(thisSegmentation,i-1); + virtual void SetSegmentationModel(Int_t isec, AliSegmentation* thisSegmentation) { + fSegmentation->AddAt(thisSegmentation,isec-1); + } + virtual void SetSegmentationModel(Int_t isec, AliMUONGeometrySegmentation* thissegmentation) { + fSegmentation2->AddAt(thissegmentation,isec-1); } // // Get pointer to response model @@ -63,6 +71,10 @@ class AliMUONChamber : public TObject } virtual TObjArray* ChamberSegmentation() {return fSegmentation;} + virtual AliMUONGeometrySegmentation* SegmentationModel2(Int_t isec) { + return (AliMUONGeometrySegmentation*) (*fSegmentation2)[isec-1]; + } + // Get number of segmentation sectors virtual Int_t Nsec() const {return fnsec;} // Set number of segmented cathodes (1 or 2) @@ -75,9 +87,11 @@ class AliMUONChamber : public TObject // // Ask segmentation if signal should be generated virtual Int_t SigGenCond(Float_t x, Float_t y, Float_t z); + virtual Int_t SigGenCond(AliMUONHit* hit); // // Initialisation of segmentation for hit virtual void SigGenInit(Float_t x, Float_t y, Float_t z); + virtual void SigGenInit(AliMUONHit* hit); // Initialisation of charge fluctuation for given hit virtual void ChargeCorrelationInit(); @@ -102,6 +116,8 @@ class AliMUONChamber : public TObject virtual void DisIntegration(Float_t eloss, Float_t tof, Float_t xhit, Float_t yhit, Float_t zhit, Int_t& x, Float_t newclust[6][500]); + virtual void DisIntegration(AliMUONHit* hit, + Int_t& x, Float_t newclust[6][500]); // Initialize geometry related parameters virtual void InitGeo(Float_t z); // @@ -131,8 +147,11 @@ class AliMUONChamber : public TObject Float_t fCurrentCorrel; //! charge correlation for current hit. TObjArray *fSegmentation; // pointer to segmentation + TObjArray *fSegmentation2; // pointer to geometry segmentation bending & NBending + AliMUONResponse *fResponse; // pointer to response AliMUONGeometryModule *fGeometry; // pointer to geometry + AliMUON *fMUON; // pointer to MUON ClassDef(AliMUONChamber,3) // Muon tracking chamber class }; diff --git a/MUON/AliMUONClusterFinderVS.cxx b/MUON/AliMUONClusterFinderVS.cxx index 6405076b949..122bbb3367f 100644 --- a/MUON/AliMUONClusterFinderVS.cxx +++ b/MUON/AliMUONClusterFinderVS.cxx @@ -1919,7 +1919,33 @@ void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c) fNPeaks++; } } +void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster& c) +{ + // + // Add a raw cluster copy to the list + // + +// AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON"); +// pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c); +// fNRawClusters++; + + + TClonesArray &lrawcl = *fRawClusters; + new(lrawcl[fNRawClusters++]) AliMUONRawCluster(c); + AliDebug(1,Form("\nfNRawClusters %d\n",fNRawClusters)); +} + +AliMUONClusterFinderVS& AliMUONClusterFinderVS +::operator = (const AliMUONClusterFinderVS& rhs) +{ +// Protected assignement operator + + if (this == &rhs) return *this; + AliFatal("Not implemented."); + + return *this; +} // // Minimisation functions @@ -2009,51 +2035,3 @@ void fcnCombiS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par } f=chisq; } - -void AliMUONClusterFinderVS::AddRawCluster(const AliMUONRawCluster& c) -{ - // - // Add a raw cluster copy to the list - // - -// AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON"); -// pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c); -// fNRawClusters++; - - - TClonesArray &lrawcl = *fRawClusters; - new(lrawcl[fNRawClusters++]) AliMUONRawCluster(c); - AliDebug(1,Form("\nfNRawClusters %d\n",fNRawClusters)); -} - -Bool_t AliMUONClusterFinderVS::TestTrack(Int_t t) const { -// Test if track was user selected - if (fTrack[0]==-1 || fTrack[1]==-1) { - return kTRUE; - } else if (t==fTrack[0] || t==fTrack[1]) { - return kTRUE; - } else { - return kFALSE; - } -} - -AliMUONClusterFinderVS& AliMUONClusterFinderVS -::operator = (const AliMUONClusterFinderVS& rhs) -{ -// Protected assignement operator - - if (this == &rhs) return *this; - - AliFatal("Not implemented."); - - return *this; -} - - - - - - - - - diff --git a/MUON/AliMUONClusterFinderVS.h b/MUON/AliMUONClusterFinderVS.h index ffa68abb9dd..01f25f1c08f 100644 --- a/MUON/AliMUONClusterFinderVS.h +++ b/MUON/AliMUONClusterFinderVS.h @@ -16,7 +16,6 @@ class TClonesArray; class AliMUONClusterInput; class AliMUONHitMapA1; -class AliMUONResponse; class AliSegmentation; class AliMUONRawCluster; class AliMUONDigit; @@ -56,7 +55,6 @@ class AliMUONClusterFinderVS : public TObject virtual void AddRawCluster(const AliMUONRawCluster& cluster); // Set tracks for debugging virtual void SetTracks(Int_t t1, Int_t t2) {fTrack[0]=t1; fTrack[1]=t2;} - virtual Bool_t TestTrack(Int_t t) const; // debug level void SetDebugLevel(Int_t level) {fDebugLevel = level;} void SetGhostChi2Cut(Float_t cut) {fGhostChi2Cut = cut;} diff --git a/MUON/AliMUONClusterInput.cxx b/MUON/AliMUONClusterInput.cxx index 6fb69987e43..d89ea6b163e 100644 --- a/MUON/AliMUONClusterInput.cxx +++ b/MUON/AliMUONClusterInput.cxx @@ -84,11 +84,15 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesAr AliMUONChamber* iChamber; pMUON = (AliMUON*) gAlice->GetModule("MUON"); - iChamber = &(pMUON->Chamber(chamber)); + if ((fSegmentationType = pMUON->WhichSegmentation()) != 1) + AliFatal("Wrong segmentation type"); + iChamber = &(pMUON->Chamber(chamber)); fgMathieson = new AliMUONMathieson(); + fSegmentation[0]=iChamber->SegmentationModel(1); fSegmentation[1]=iChamber->SegmentationModel(2); + fNseg = 2; if (chamber < AliMUONConstants::NTrackingCh()) { if (chamber > 1 ) { @@ -113,9 +117,71 @@ void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig) AliMUONChamber* iChamber; pMUON = (AliMUON*) gAlice->GetModule("MUON"); - iChamber = &(pMUON->Chamber(chamber)); + if ((fSegmentationType = pMUON->WhichSegmentation()) != 1) + AliFatal("Wrong segmentation type"); + iChamber = &(pMUON->Chamber(chamber)); fSegmentation[0]=iChamber->SegmentationModel(1); + + fNseg=1; +} +void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2) +{ + // Set pointer to digits with corresponding segmentations and responses (two cathode planes) + fChamber = chamber; + fDetElemId = idDE; + fDigits[0] = dig1; + fDigits[1] = dig2; + fNDigits[0] = dig1->GetEntriesFast(); + fNDigits[1] = dig2->GetEntriesFast(); + + AliMUON *pMUON; + AliMUONChamber* iChamber; + + pMUON = (AliMUON*) gAlice->GetModule("MUON"); + iChamber = &(pMUON->Chamber(chamber)); + + fgMathieson = new AliMUONMathieson(); + if ((fSegmentationType = pMUON->WhichSegmentation()) != 2) + AliFatal("Wrong segmentation type"); + + fSegmentation2[0]=iChamber->SegmentationModel2(1); + fSegmentation2[1]=iChamber->SegmentationModel2(2); + + fNseg = 2; + if (chamber < AliMUONConstants::NTrackingCh()) { + if (chamber > 1 ) { + fgMathieson->SetPitch(AliMUONConstants::Pitch()); + fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3()); + fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3()); + fChargeCorrel = AliMUONConstants::ChargeCorrel(); + } else { + fgMathieson->SetPitch(AliMUONConstants::PitchSt1()); + fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1()); + fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1()); + fChargeCorrel = AliMUONConstants::ChargeCorrelSt1(); + } + } +} + +void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig) +{ +// Set pointer to digits with corresponding segmentations and responses (one cathode plane) + + fChamber = chamber; + fDetElemId = idDE; + fDigits[0] = dig; + + AliMUON *pMUON; + AliMUONChamber* iChamber; + + pMUON = (AliMUON*) gAlice->GetModule("MUON"); + iChamber = &(pMUON->Chamber(chamber)); + if ((fSegmentationType = pMUON->WhichSegmentation()) != 2) + AliFatal("Wrong segmentation type"); + + fSegmentation2[0]=iChamber->SegmentationModel2(1); + fNseg=1; } @@ -151,7 +217,11 @@ void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) qtot+=fCharge[i][cath]; // Current z Float_t xc, yc; - fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ); + if (fSegmentationType == 1) + fSegmentation[cath]->GetPadC(ix,iy,xc,yc,fZ); + else + fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ); + } // loop over cluster digits fQtot[cath]=qtot; fChargeTot[cath]=Int_t(qtot); @@ -171,10 +241,21 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cat // par[0] x-position of cluster // par[1] y-position of cluster - fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); -// First Cluster - fSegmentation[cath]->SetHit(par[0],par[1],fZ); - Float_t q1=fgMathieson->IntXY(fSegmentation[cath]); + Float_t q1; + if (fSegmentationType == 1) { + + fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation[cath]->SetHit(par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fSegmentation[cath]); + + } else { + + fSegmentation2[cath]->SetPad(fDetElemId, fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation2[cath]->SetHit(fDetElemId, par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + } Float_t value = fQtot[cath]*q1; return value; @@ -190,17 +271,33 @@ Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par) // par[4] charge fraction of first cluster // 1-par[4] charge fraction of second cluster - fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); -// First Cluster - fSegmentation[0]->SetHit(par[0],par[1],fZ); - Float_t q1=fgMathieson->IntXY(fSegmentation[0]); + Float_t q1, q2; + + if (fSegmentationType == 1) { + + fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); + // First Cluster + fSegmentation[0]->SetHit(par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fSegmentation[0]); -// Second Cluster - fSegmentation[0]->SetHit(par[2],par[3],fZ); - Float_t q2=fgMathieson->IntXY(fSegmentation[0]); + // Second Cluster + fSegmentation[0]->SetHit(par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fSegmentation[0]); + + } else { + + fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]); + // First Cluster + fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fSegmentation[0]); - Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); - return value; + // Second Cluster + fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]); + } + + Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); + return value; } Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath) @@ -213,21 +310,36 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cat // 1-par[4] charge fraction of second cluster // par[5] charge fraction of first cluster - second cathode - fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); -// First Cluster - fSegmentation[cath]->SetHit(par[0],par[1],fZ); - Float_t q1=fgMathieson->IntXY(fSegmentation[cath]); + Float_t q1, q2; + + if (fSegmentationType == 1) { + + fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation[cath]->SetHit(par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fSegmentation[cath]); -// Second Cluster - fSegmentation[cath]->SetHit(par[2],par[3],fZ); - Float_t q2=fgMathieson->IntXY(fSegmentation[cath]); - Float_t value; - if (cath==0) { - value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); - } else { - value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); - } - return value; + // Second Cluster + fSegmentation[cath]->SetHit(par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fSegmentation[cath]); + + } else { + fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + + // Second Cluster + fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + } + Float_t value; + if (cath==0) { + value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); + } else { + value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); + } + return value; } AliMUONClusterInput& AliMUONClusterInput diff --git a/MUON/AliMUONClusterInput.h b/MUON/AliMUONClusterInput.h index dddfdb8fc2b..11c380bd397 100644 --- a/MUON/AliMUONClusterInput.h +++ b/MUON/AliMUONClusterInput.h @@ -8,6 +8,7 @@ #include #include // needed for inline function Digit +#include "AliMUONGeometrySegmentation.h" class TMinuit; @@ -24,6 +25,8 @@ class AliMUONClusterInput : public TObject // Configuration void SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2); void SetDigits(Int_t chamber, TClonesArray* dig); + void SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2); + void SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig); void SetCluster(AliMUONRawCluster* cluster); // Access functions Int_t Chamber() const {return fChamber;} @@ -33,6 +36,7 @@ class AliMUONClusterInput : public TObject AliSegmentation* Segmentation(Int_t cath) const {return fSegmentation[cath];} AliMUONMathieson* Mathieson() const {return fgMathieson;} Float_t ChargeCorrel() const {return fChargeCorrel;} + Int_t DetElemId() const {return fDetElemId;} // Fitting TMinuit* Fitter() const {return fgMinuit;} @@ -60,6 +64,8 @@ class AliMUONClusterInput : public TObject TClonesArray* fDigits[2]; // ! Array of pointers to digits Int_t fNDigits[2]; // ! Number of digits AliSegmentation* fSegmentation[2]; // ! Segmentation per cathode + AliMUONGeometrySegmentation* fSegmentation2[2]; // ! Geometry Segmentation per cathode + Int_t fNseg; // ! number of cathode planes Int_t fChamber; // ! Current chamber number @@ -74,6 +80,8 @@ class AliMUONClusterInput : public TObject Float_t fQtot[2]; // ! Total charge Float_t fZ; // ! Current z-position Float_t fChargeCorrel; // ! charge correlation + Int_t fSegmentationType;// ! Segmentation type old or new + Int_t fDetElemId; // ! detection elt id // Fitter static TMinuit* fgMinuit; // ! Fitter diff --git a/MUON/AliMUONClusterReconstructor.cxx b/MUON/AliMUONClusterReconstructor.cxx index 71c17eca70f..9a6caf339eb 100644 --- a/MUON/AliMUONClusterReconstructor.cxx +++ b/MUON/AliMUONClusterReconstructor.cxx @@ -27,6 +27,7 @@ #include "AliRunLoader.h" #include "AliLoader.h" +#include "AliMUON.h" #include "AliMUONDigit.h" #include "AliMUONConstants.h" #include "AliMUONData.h" @@ -107,6 +108,21 @@ AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void) //____________________________________________________________________ void AliMUONClusterReconstructor::Digits2Clusters() { +// +// Perform cluster finding +// + + AliMUON* pMUON = (AliMUON*) gAlice->GetModule("MUON"); + if (pMUON->WhichSegmentation() == 1) + Digits2ClustersOld(); + else + Digits2ClustersNew(); + +} +//____________________________________________________________________ +void AliMUONClusterReconstructor::Digits2ClustersOld() +{ + // // Perform cluster finding // @@ -121,36 +137,134 @@ void AliMUONClusterReconstructor::Digits2Clusters() for (Int_t ich = 0; ich < 10; ich++) { - fMUONData->ResetDigits(); - fMUONData->GetCathode(0); - //TClonesArray * - muonDigits = fMUONData->Digits(ich); - ndig=muonDigits->GetEntriesFast(); - AliDebug(1,Form("1 Found %d digits in %p chamber %d", ndig, (void*)muonDigits,ich)); - TClonesArray &lhits1 = *dig1; - Int_t n = 0; - for (k = 0; k < ndig; k++) { - digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); - if (fRecModel->TestTrack(digit->Track(0))) - new(lhits1[n++]) AliMUONDigit(*digit); + fMUONData->ResetDigits(); + fMUONData->GetCathode(0); + //TClonesArray * + muonDigits = fMUONData->Digits(ich); + ndig=muonDigits->GetEntriesFast(); + AliDebug(1,Form("1 Found %d digits in %p chamber %d", ndig, (void*)muonDigits,ich)); + TClonesArray &lhits1 = *dig1; + Int_t n = 0; + for (k = 0; k < ndig; k++) { + digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); + new(lhits1[n++]) AliMUONDigit(*digit); + } + fMUONData->ResetDigits(); + fMUONData->GetCathode(1); + muonDigits = fMUONData->Digits(ich); + ndig=muonDigits->GetEntriesFast(); + AliDebug(1,Form("2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich)); + TClonesArray &lhits2 = *dig2; + n=0; + + for (k=0; kUncheckedAt(k); + new(lhits2[n++]) AliMUONDigit(*digit); + } + + if (fRecModel) { + AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); + fRecModel->FindRawClusters(); + } + // copy into the container + TClonesArray* tmp = fRecModel->GetRawClusters(); + for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) { + AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); + fMUONData->AddRawCluster(ich, *pClus); + } + dig1->Delete(); + dig2->Delete(); + } // for ich + delete dig1; + delete dig2; +} +//____________________________________________________________________ +void AliMUONClusterReconstructor::Digits2ClustersNew() +{ + + TClonesArray *dig1, *dig2, *digAll; + Int_t ndig, k, idDE, idDE_prev; + dig1 = new TClonesArray("AliMUONDigit",1000); + dig2 = new TClonesArray("AliMUONDigit",1000); + digAll = new TClonesArray("AliMUONDigit",2000); + + AliMUONDigit* digit; + + TArrayI id(100); // contains the different IdDE + id.Reset(); + +// Loop on chambers and on cathode planes + TClonesArray* muonDigits; + Int_t n2; + Int_t n1; + Int_t flag = 0; + + for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) { + n1 = 0; + n2 = 0; + //cathode 0 + fMUONData->ResetDigits(); + fMUONData->GetCathode(0); + muonDigits = fMUONData->Digits(ich); + ndig = muonDigits->GetEntriesFast(); + TClonesArray &lDigit = *digAll; + + idDE_prev = 0; + + for (k = 0; k < ndig; k++) { + + digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); + new(lDigit[n1++]) AliMUONDigit(*digit); + idDE = digit->DetElemId(); + if (idDE != idDE_prev) + id.AddAt(idDE,n2++); + idDE_prev = idDE; + } + + //cathode 1 + fMUONData->ResetDigits(); + fMUONData->GetCathode(1); + muonDigits = fMUONData->Digits(ich); + ndig = muonDigits->GetEntriesFast(); + + for (k = 0; k < ndig; k++) { + + digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); + new(lDigit[n1++]) AliMUONDigit(*digit); + idDE = digit->DetElemId(); + flag = 0; + + for (Int_t n = 0; n < id.GetSize(); n++) { + if (id[n] == idDE) { + flag = 1; + break; + } + if (flag) continue; + id[id.GetSize()+1] = idDE; } - fMUONData->ResetDigits(); - fMUONData->GetCathode(1); - muonDigits = fMUONData->Digits(ich); - ndig=muonDigits->GetEntriesFast(); - AliDebug(1,Form("2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich)); + } + + // loop over id DE + for (idDE = 0; idDE < id.GetSize(); idDE++) { + + TClonesArray &lhits1 = *dig1; TClonesArray &lhits2 = *dig2; - n=0; - - for (k=0; kUncheckedAt(k); - if (fRecModel->TestTrack(digit->Track(0))) - new(lhits2[n++]) AliMUONDigit(*digit); + n1 = n2 = 0; + + for (k = 0; k < digAll->GetEntriesFast(); k++) { + digit = (AliMUONDigit*) digAll->UncheckedAt(k); + if (id[idDE] == digit->DetElemId()) + if (digit->Cathode() == 1) + new(lhits1[n1++]) AliMUONDigit(*digit); + else + new(lhits2[n2++]) AliMUONDigit(*digit); + } - if (fRecModel) { - AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); - fRecModel->FindRawClusters(); + // cluster finder + if (fRecModel) { + AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2); + fRecModel->FindRawClusters(); } // copy into the container TClonesArray* tmp = fRecModel->GetRawClusters(); @@ -160,9 +274,13 @@ void AliMUONClusterReconstructor::Digits2Clusters() } dig1->Delete(); dig2->Delete(); + digAll->Delete(); + + } } // for ich delete dig1; delete dig2; + delete digAll; } //____________________________________________________________________ diff --git a/MUON/AliMUONClusterReconstructor.h b/MUON/AliMUONClusterReconstructor.h index cd93836111e..825dd74c9fe 100644 --- a/MUON/AliMUONClusterReconstructor.h +++ b/MUON/AliMUONClusterReconstructor.h @@ -30,6 +30,9 @@ class AliMUONClusterReconstructor : public TObject // Cluster Finding & Trigger virtual void Digits2Clusters(); + virtual void Digits2ClustersOld(); + virtual void Digits2ClustersNew(); + virtual void Digits2Clusters(AliRawReader* rawReader); virtual void Trigger2Trigger() ; virtual void Trigger2Trigger(AliRawReader* rawReader); diff --git a/MUON/AliMUONDigit.cxx b/MUON/AliMUONDigit.cxx index 4aa774b85d1..c8d8432bf33 100644 --- a/MUON/AliMUONDigit.cxx +++ b/MUON/AliMUONDigit.cxx @@ -30,6 +30,7 @@ ClassImp(AliMUONDigit) fSignal = digits.fSignal; fPhysics = digits.fPhysics; fHit = digits.fHit; + fDetElemId = digits.fDetElemId; for(Int_t i=0; i d->DetElemId()) ? 1 : -1; + +} diff --git a/MUON/AliMUONDigit.h b/MUON/AliMUONDigit.h index ef8b0eb6d02..9428501583c 100644 --- a/MUON/AliMUONDigit.h +++ b/MUON/AliMUONDigit.h @@ -21,6 +21,10 @@ class AliMUONDigit : public TObject { AliMUONDigit& operator=(const AliMUONDigit& rhs); + virtual Bool_t IsSortable() const {return kTRUE;} + virtual int Compare(const TObject *obj) const; + + virtual Int_t DetElemId()const {return fDetElemId;} virtual Int_t PadX() const {return fPadX;} virtual Int_t PadY() const {return fPadY;} virtual Int_t Signal() const {return fSignal;} @@ -41,7 +45,8 @@ class AliMUONDigit : public TObject { Int_t fTracks[kMAXTRACKS]; // primary tracks making this digit (up to 10) Int_t fPhysics; // physics contribution to signal Int_t fHit; // hit number - temporary solution + Int_t fDetElemId; // Detection element ID - ClassDef(AliMUONDigit,1) //Digits for MUON + ClassDef(AliMUONDigit,2) //Digits for MUON }; #endif diff --git a/MUON/AliMUONDigitizer.cxx b/MUON/AliMUONDigitizer.cxx index bc06384a185..1a9f407a787 100644 --- a/MUON/AliMUONDigitizer.cxx +++ b/MUON/AliMUONDigitizer.cxx @@ -119,7 +119,18 @@ AliMUONDigitizer::operator=(const AliMUONDigitizer& rhs) return *this; } - + +//------------------------------------------------------------------------ +Int_t AliMUONDigitizer::GetSegmentation() +{ + if (!fMUON->WhichSegmentation()) { + AliFatal("No Segmentation Type defined."); + return kFALSE; + } else + return fMUON->WhichSegmentation(); + +} + //------------------------------------------------------------------------ Bool_t AliMUONDigitizer::Init() { @@ -265,27 +276,28 @@ void AliMUONDigitizer::CreateDigits() // Loops over the fTDList for each cathode, gets the correct signal for the // digit and adds the new digit to the output stream. - AliDebug(2, "Creating digits..."); - for (Int_t icat = 0; icat < 2; icat++) - { - // - // Filling Digit List - Int_t nentries = fTDList->GetEntriesFast(); - for (Int_t nent = 0; nent < nentries; nent++) - { - AliMUONTransientDigit* td = (AliMUONTransientDigit*)fTDList->At(nent); - if (td == NULL) continue; + fTDList->Sort(); // sort by idDE + AliDebug(2, "Creating digits..."); + for (Int_t icat = 0; icat < 2; icat++) { + + // + // Filling Digit List + Int_t nentries = fTDList->GetEntriesFast(); + for (Int_t nent = 0; nent < nentries; nent++) { + + AliMUONTransientDigit* td = (AliMUONTransientDigit*)fTDList->At(nent); + if (td == NULL) continue; - // Must be the same cathode, otherwise we will fill a mixture - // of digits from both cathodes. - if (icat != td->Cathode() - 1) continue; + // Must be the same cathode, otherwise we will fill a mixture + // of digits from both cathodes. + if (icat != td->Cathode() - 1) continue; - AliDebug(3,Form( "Creating digit from transient digit 0x%X", (void*)td)); + AliDebug(3,Form( "Creating digit from transient digit 0x%X", (void*)td)); - Int_t q = GetSignalFrom(td); - if (q > 0) AddDigit(td, q); - } - FillOutputData(); + Int_t q = GetSignalFrom(td); + if (q > 0) AddDigit(td, q); + } + FillOutputData(); } } @@ -303,7 +315,7 @@ void AliMUONDigitizer::AddDigit(AliMUONTransientDigit* td, Int_t responseCharge) Int_t tracks[kMAXTRACKS]; Int_t charges[kMAXTRACKS]; - Int_t digits[6]; + Int_t digits[7]; digits[0] = td->PadX(); digits[1] = td->PadY(); @@ -311,33 +323,36 @@ void AliMUONDigitizer::AddDigit(AliMUONTransientDigit* td, Int_t responseCharge) digits[3] = responseCharge; digits[4] = td->Physics(); digits[5] = td->Hit(); - + if (GetSegmentation() == 1) + digits[6] = 0; + else + digits[6] = td->DetElemId(); + Int_t nptracks = td->GetNTracks(); - if (nptracks > kMAXTRACKS) - { - AliDebug(1, Form( - "TransientDigit returned the number of tracks to be %d, which is bigger than kMAXTRACKS.", - nptracks)); - AliDebug(1, Form("Reseting the number of tracks to be %d.", kMAXTRACKS)); - nptracks = kMAXTRACKS; + if (nptracks > kMAXTRACKS) { + + AliDebug(1, Form( + "TransientDigit returned the number of tracks to be %d, which is bigger than kMAXTRACKS.", + nptracks)); + AliDebug(1, Form("Reseting the number of tracks to be %d.", kMAXTRACKS)); + nptracks = kMAXTRACKS; } - for (Int_t i = 0; i < nptracks; i++) - { - tracks[i] = td->GetTrack(i); - charges[i] = td->GetCharge(i); + for (Int_t i = 0; i < nptracks; i++) { + + tracks[i] = td->GetTrack(i); + charges[i] = td->GetCharge(i); } // Sort list of tracks according to charge SortTracks(tracks,charges,nptracks); - if (nptracks < kMAXTRACKS ) - { - for (Int_t i = nptracks; i < kMAXTRACKS; i++) - { - tracks[i] = -1; - charges[i] = 0; - } + if (nptracks < kMAXTRACKS ) { + + for (Int_t i = nptracks; i < kMAXTRACKS; i++) { + tracks[i] = -1; + charges[i] = 0; + } } AliDebug(4,Form( "Adding digit with charge %d.", responseCharge)); @@ -529,61 +544,61 @@ void AliMUONDigitizer::SortTracks(Int_t *tracks, Int_t *charges, Int_t ntr) cons // Only the 3 most significant tracks are actually sorted // - if (ntr <= 1) return; + if (ntr <= 1) return; - // - // Loop over signals, only 3 times - // + // + // Loop over signals, only 3 times + // - Int_t qmax; - Int_t jmax; - Int_t idx[3] = {-2,-2,-2}; - Int_t jch[3] = {-2,-2,-2}; - Int_t jtr[3] = {-2,-2,-2}; - Int_t i, j, imax; + Int_t qmax; + Int_t jmax; + Int_t idx[3] = {-2,-2,-2}; + Int_t jch[3] = {-2,-2,-2}; + Int_t jtr[3] = {-2,-2,-2}; + Int_t i, j, imax; - if (ntr < 3) imax = ntr; - else imax=3; + if (ntr < 3) imax = ntr; + else imax=3; - for(i = 0; i < imax; i++) - { - qmax=0; - jmax=0; - - for(j = 0; j < ntr; j++) - { - if ( (i == 1 && j == idx[i-1]) || - (i == 2 && (j == idx[i-1] || j == idx[i-2])) - ) - continue; - - if(charges[j] > qmax) - { - qmax = charges[j]; - jmax = j; - } - } - - if(qmax > 0) - { - idx[i] = jmax; - jch[i] = charges[jmax]; - jtr[i] = tracks[jmax]; - } - - } - - for(i = 0; i < 3; i++) - { - if (jtr[i] == -2) - { - charges[i] = 0; - tracks[i] = 0; - } - else - { - charges[i] = jch[i]; - tracks[i] = jtr[i]; - } - } + for(i = 0; i < imax; i++) + { + qmax=0; + jmax=0; + + for(j = 0; j < ntr; j++) + { + if ( (i == 1 && j == idx[i-1]) || + (i == 2 && (j == idx[i-1] || j == idx[i-2])) + ) + continue; + + if(charges[j] > qmax) + { + qmax = charges[j]; + jmax = j; + } + } + + if(qmax > 0) + { + idx[i] = jmax; + jch[i] = charges[jmax]; + jtr[i] = tracks[jmax]; + } + + } + + for(i = 0; i < 3; i++) + { + if (jtr[i] == -2) + { + charges[i] = 0; + tracks[i] = 0; + } + else + { + charges[i] = jch[i]; + tracks[i] = jtr[i]; + } + } } diff --git a/MUON/AliMUONDigitizer.h b/MUON/AliMUONDigitizer.h index ab3cb6c0722..31a50250de4 100644 --- a/MUON/AliMUONDigitizer.h +++ b/MUON/AliMUONDigitizer.h @@ -171,6 +171,7 @@ protected: virtual void CleanupTriggerArrays() = 0; virtual void FillTriggerOutput() = 0; virtual void AddDigitTrigger(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) = 0; + virtual Int_t GetSegmentation(); AliRunLoader* fRunLoader; //! Global run loader. AliMUONLoader* fGime; //! MUON specific loader. @@ -183,6 +184,7 @@ protected: Int_t fTDCounter; //! nr. of AliMUONTransientDigit Int_t fMask; //! mask dependent on input file Bool_t fSignal; //! kTRUE if signal file is processed + Int_t fSegmentation; //! segmentation type 1=old, 2=new; private: diff --git a/MUON/AliMUONDigitizerv1.cxx b/MUON/AliMUONDigitizerv1.cxx index e2bf0207cbe..ab07f0b9674 100644 --- a/MUON/AliMUONDigitizerv1.cxx +++ b/MUON/AliMUONDigitizerv1.cxx @@ -111,7 +111,11 @@ void AliMUONDigitizerv1::GenerateTransientDigits() { // Tracking Chamber // Initialize hit position (cursor) in the segmentation model - chamber.SigGenInit(mHit->X(), mHit->Y(), mHit->Z()); + if (GetSegmentation() == 1) // old segmentation + chamber.SigGenInit(mHit->X(), mHit->Y(), mHit->Z()); + else + chamber.SigGenInit(mHit); + } // else do nothing for Trigger Chambers MakeTransientDigitsFromHit(itrack, ihit, mHit); @@ -138,13 +142,16 @@ void AliMUONDigitizerv1::MakeTransientDigitsFromHit(Int_t track, Int_t iHit, Ali Int_t nnew=0; // Number of touched Pads per hit Int_t ichamber = mHit->Chamber()-1; AliMUONChamber& chamber = fMUON->Chamber(ichamber); - chamber.DisIntegration(mHit->Eloss(), mHit->Age(), mHit->X(), mHit->Y(), mHit->Z(), nnew, newdigit); + if (GetSegmentation() == 1) + chamber.DisIntegration(mHit->Eloss(), mHit->Age(), mHit->X(), mHit->Y(), mHit->Z(), nnew, newdigit); + else + chamber.DisIntegration(mHit, nnew, newdigit); // Creating new TransientDigits from hit for(Int_t iTD = 0; iTD < nnew; iTD++) { Int_t charge; - Int_t digits[6]; + Int_t digits[7]; digits[0] = Int_t(newdigit[1][iTD]); // Padx of the Digit digits[1] = Int_t(newdigit[2][iTD]); // Pady of the Digit @@ -161,10 +168,14 @@ void AliMUONDigitizerv1::MakeTransientDigitsFromHit(Int_t track, Int_t iHit, Ali digits[4] = 0; // No signal due to physics since this is now background. } digits[5] = iHit+fMask; // Hit number in the list + if (GetSegmentation() == 1) + digits[6] = 0; + else + digits[6] = mHit->DetElemId(); AliDebug(5,Form("MakeTransientDigitsFromHit", - "DisIntegration result %d: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d", - iTD, digits[0], digits[1], digits[2], digits[3], digits[5])); + "DisIntegration result %d: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d\tidDE %d", + iTD, digits[0], digits[1], digits[2], digits[3], digits[5], digits[6])); AliMUONTransientDigit* mTD = new AliMUONTransientDigit(ichamber, digits); mTD->AddToTrackList(track + fMask, charge); @@ -175,14 +186,14 @@ void AliMUONDigitizerv1::MakeTransientDigitsFromHit(Int_t track, Int_t iHit, Ali } //------------------------------------------------------------------------ -void AliMUONDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) +void AliMUONDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) { // Derived to add digits to TreeD. fMUONData->AddDigit(chamber, tracks, charges, digits); } //------------------------------------------------------------------------ -void AliMUONDigitizerv1::AddDigitTrigger(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) +void AliMUONDigitizerv1::AddDigitTrigger(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) { // Derived to add digits to TreeD for trigger. fTrigDec->AddDigit(chamber, tracks, charges, digits); diff --git a/MUON/AliMUONDigitizerv2.cxx b/MUON/AliMUONDigitizerv2.cxx index e801df24168..c549286f71a 100644 --- a/MUON/AliMUONDigitizerv2.cxx +++ b/MUON/AliMUONDigitizerv2.cxx @@ -98,7 +98,7 @@ void AliMUONDigitizerv2::MakeTransientDigitFromSDigit(Int_t iChamber, AliMUONDig // Once the digit is created it is added to the fTDList. AliDebug(4,Form("Making transient digit from s-digit for chamber %d.", iChamber)); - Int_t digits[6]; + Int_t digits[7]; // // Creating a new TransientDigits from SDigit digits[0] = sDigit->PadX(); // Padx of the Digit @@ -111,9 +111,14 @@ void AliMUONDigitizerv2::MakeTransientDigitFromSDigit(Int_t iChamber, AliMUONDig digits[4] = 0; digits[5] = sDigit->Hit(); // Hit number in the list + if (GetSegmentation() == 1) + digits[6] = 0; + else + digits[6] = sDigit->DetElemId(); + + AliDebug(5,Form("Made digit from sDigit 0x%X: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d\tidDE %d", + (void*)sDigit, digits[0], digits[1], digits[2], digits[3], digits[5], digits[6])); - AliDebug(5,Form("Made digit from sDigit 0x%X: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d", - (void*)sDigit, digits[0], digits[1], digits[2], digits[3], digits[5])); AliMUONTransientDigit* mTD = new AliMUONTransientDigit(iChamber, digits); // Copy list of tracks and trackcharge @@ -129,7 +134,7 @@ void AliMUONDigitizerv2::MakeTransientDigitFromSDigit(Int_t iChamber, AliMUONDig } //------------------------------------------------------------------------ -void AliMUONDigitizerv2::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) +void AliMUONDigitizerv2::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) { // Override to add new digits to the digits tree TreeD. fMUONData->AddDigit(chamber, tracks, charges, digits); diff --git a/MUON/AliMUONFactory.h b/MUON/AliMUONFactory.h index 8f825ed8e74..b811d2859ec 100644 --- a/MUON/AliMUONFactory.h +++ b/MUON/AliMUONFactory.h @@ -21,8 +21,8 @@ class AliMUONFactory : public TObject { AliMUONFactory(); virtual ~AliMUONFactory(); - void Build(AliMUON* where, const char* what); - void BuildStation(AliMUON* where, Int_t stationNumber); + virtual void Build(AliMUON* where, const char* what); + virtual void BuildStation(AliMUON* where, Int_t stationNumber); protected: AliMUONFactory(const AliMUONFactory& rhs); diff --git a/MUON/AliMUONFactoryV2.cxx b/MUON/AliMUONFactoryV2.cxx new file mode 100644 index 00000000000..e2ae70dd230 --- /dev/null +++ b/MUON/AliMUONFactoryV2.cxx @@ -0,0 +1,1092 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +//////////////////////////////////////////////////////////// +// Factory for muon chambers, segmentations and response // +//////////////////////////////////////////////////////////// + +/* $Id$ */ + +#include "AliMUONFactoryV2.h" +#include "AliRun.h" +#include "AliSegmentation.h" +#include "AliLog.h" + +#include "AliMUON.h" +#include "AliMUONConstants.h" +#include "AliMUONTriggerConstants.h" +#include "AliMUONChamber.h" +#include "AliMUONResponseV0.h" +#include "AliMUONGeometryModule.h" +#include "AliMUONGeometryStore.h" +#include "AliMUONGeometrySegmentation.h" +#include "AliMUONSt12QuadrantSegmentation.h" +#include "AliMUONSt345SlatSegmentation.h" +#include "AliMUONTriggerSegmentation.h" +#include "AliMUONResponseTrigger.h" + +ClassImp(AliMUONFactoryV2) + +//__________________________________________________________________________ + AliMUONFactoryV2::AliMUONFactoryV2() + : AliMUONFactory(), + fMUON(0), + fResponse0(0) +{ + // FactoryV2 inherite from Factory for switching in AliMUONv1::Init() + // to be changed when old segmentation will be removed. +} + +//__________________________________________________________________________ +AliMUONFactoryV2::AliMUONFactoryV2(const AliMUONFactoryV2& rhs) + : AliMUONFactory(rhs) +{ + // Protected copy constructor + + AliFatal("Not implemented."); +} + +//__________________________________________________________________________ + +AliMUONFactoryV2::~AliMUONFactoryV2() +{ + // +} + +//__________________________________________________________________________ +AliMUONFactoryV2& AliMUONFactoryV2::operator=(const AliMUONFactoryV2& rhs) +{ + // Protected assignement operator + + if (this == &rhs) return *this; + + AliFatal("Not implemented."); + + return *this; +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildCommon() +{ + // + // Construct the default response. + // + + // Default response: 5 mm of gas + fResponse0 = new AliMUONResponseV0; + fResponse0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085) + fResponse0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840) + fResponse0->SetPitch(AliMUONConstants::Pitch()); // anode-cathode distance + fResponse0->SetSigmaIntegration(10.); + fResponse0->SetChargeSlope(10); + fResponse0->SetChargeSpread(0.18, 0.18); + fResponse0->SetMaxAdc(4096); + fResponse0->SetSaturation(3000); + fResponse0->SetZeroSuppression(6); +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation1() +{ + //-------------------------------------------------------- + // Configuration for Chamber TC1/2 (Station 1) ---------- + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + // Response for 4 mm of gas (station 1) + // automatic consistency with width of sensitive medium in CreateGeometry ???? + AliMUONResponseV0* responseSt1 = new AliMUONResponseV0; + // Mathieson parameters from L.Kharmandarian's thesis, page 190 + responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900) + responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700) + responseSt1->SetPitch(AliMUONConstants::PitchSt1()); // anode-cathode distance + responseSt1->SetSigmaIntegration(10.); + // ChargeSlope larger to compensate for the smaller anode-cathode distance + // and keep the same most probable ADC channel for mip's + responseSt1->SetChargeSlope(62.5); + // assumed proportionality to anode-cathode distance for ChargeSpread + responseSt1->SetChargeSpread(0.144, 0.144); + responseSt1->SetMaxAdc(4096); + responseSt1->SetSaturation(3000); + responseSt1->SetZeroSuppression(6); + + // Quadrant segmentations: + AliMUONSt12QuadrantSegmentation* bendSt1 + = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane); + AliMUONSt12QuadrantSegmentation* nonbendSt1 + = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane); + + AliMUONGeometrySegmentation* segmentation[2]; + + for (Int_t chamber = 0; chamber < 2; chamber++) { + + segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + // id detection elt for chamber 1 + Int_t id0 = (chamber+1)*100; + + //-------------------------------------------------------- + // Configuration for Chamber TC1/2 (Station 1) ---------- + + + fMUON->SetNsec(chamber,2); + + // cathode 0 + segmentation[0]->Add(id0, bendSt1); + segmentation[0]->Add(id0 + 1, nonbendSt1); + segmentation[0]->Add(id0 + 50, bendSt1); + segmentation[0]->Add(id0 + 51, nonbendSt1); + fMUON->SetSegmentationModel(chamber, 1, segmentation[0]); + + // cathode 1 + segmentation[1]->Add(id0, nonbendSt1); + segmentation[1]->Add(id0 + 1, bendSt1); + segmentation[1]->Add(id0 + 50, nonbendSt1); + segmentation[1]->Add(id0 + 51, bendSt1); + fMUON->SetSegmentationModel(chamber, 2, segmentation[1]); + + fMUON->SetResponseModel(chamber, responseSt1); // special response + fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread + + } +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation2() +{ + // + //-------------------------------------------------------- + // Configuration for Chamber TC3/4 (Station 2) ----------- + ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + // Quadrant segmentations: + AliMUONSt12QuadrantSegmentation* bendSt2 + = new AliMUONSt12QuadrantSegmentation(kStation2, kBendingPlane); + AliMUONSt12QuadrantSegmentation* nonbendSt2 + = new AliMUONSt12QuadrantSegmentation(kStation2, kNonBendingPlane); + + AliMUONGeometrySegmentation* segmentation[2]; + + for (Int_t chamber = 2; chamber < 4; chamber++) { + + segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + // id detection elt for chamber 1 + Int_t id0 = (chamber+1)*100; + + //-------------------------------------------------------- + // Configuration for Chamber TC3/4 (Station 2) ---------- + + + fMUON->SetNsec(chamber,2); + + // cathode 0 + segmentation[0]->Add(id0, bendSt2); + segmentation[0]->Add(id0 + 1, nonbendSt2); + segmentation[0]->Add(id0 + 50, bendSt2); + segmentation[0]->Add(id0 + 51, nonbendSt2); + fMUON->SetSegmentationModel(chamber, 1, segmentation[0]); + + // cathode 1 + segmentation[1]->Add(id0, nonbendSt2); + segmentation[1]->Add(id0 + 1, bendSt2); + segmentation[1]->Add(id0 + 50, nonbendSt2); + segmentation[1]->Add(id0 + 51, bendSt2); + fMUON->SetSegmentationModel(chamber, 2, segmentation[1]); + + fMUON->SetResponseModel(chamber, fResponse0); // normal response + fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread + + } +} + + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation3() +{ + //-------------------------------------------------------- + // Configuration for Chamber TC5/6 (Station 3) ---------- + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + AliMUONGeometrySegmentation* segmentation[2]; + + //Slats Segmentations + AliMUONSt345SlatSegmentation *slatsegB[4]; // Types of segmentation for St3 + AliMUONSt345SlatSegmentation *slatsegNB[4]; + // Bending + + Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones + for(Int_t i=0; i<4; i++) { + slatsegB[i] = new AliMUONSt345SlatSegmentation(1); + slatsegB[i]->SetPadSize(10.,0.5); + slatsegB[i]->SetPadDivision(ndiv); + slatsegB[i]->SetId(1); // Id elt ???? + slatsegB[i]->SetDAnod(AliMUONConstants::Pitch()); + slatsegNB[i] = new AliMUONSt345SlatSegmentation(0); + slatsegNB[i]->SetPadSize(0.713,10.); // Nbending + slatsegNB[i]->SetPadDivision(ndiv); + slatsegNB[i]->SetId(1); + slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch()); + } + + // Type 112200 for 500, 501, 508, 509, 510, 517 + // in Ch5 (similar for Ch6) for the futur official numbering + // Type 112200 for 503, 504, 505, 555, 554, 553 + // in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05 + Int_t n0[4] = { 0, 2, 2, 0 }; + slatsegB[0]->SetPcbBoards(n0); + slatsegB[0]->Init(0); + slatsegNB[0]->SetPcbBoards(n0); + slatsegNB[0]->Init(0); + + // Type 122200 for 502, 507, 511, 516 (similar in Ch6) + // for future official numbering of ALICE + // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) + // for actual numbering in muon code to be changed in jan05 + Int_t n1[4] = { 0, 1, 3, 0 }; + slatsegB[1]->SetPcbBoards(n1); + slatsegB[1]->Init(0); + slatsegNB[1]->SetPcbBoards(n1); + slatsegNB[1]->Init(0); + + // Type 222000 for 503, 506, 512, 515 (similar in Ch6) + // for future official numbering of ALICE + // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) + // for actual numbering in muon code to be changed in jan05 + Int_t n2[4] = { 0, 0, 3, 0 }; + slatsegB[2]->SetPcbBoards(n2); + slatsegB[2]->Init(0); + slatsegNB[2]->SetPcbBoards(n2); + slatsegNB[2]->Init(0); + + // Type 220000 for 504, 505, 513, 514 (similar in Ch6) + // for future official numbering of ALICE + // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) + // for actual numbering in muon code to be changed in jan05 + Int_t n3[4] = { 0, 0, 2, 0 }; + slatsegB[3]->SetPcbBoards(n3); + slatsegB[3]->Init(0); + slatsegNB[3]->SetPcbBoards(n3); + slatsegNB[3]->Init(0); + + for (Int_t chamber = 4; chamber < 6; chamber++) { + + segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + // id detection elt for chamber 1 + Int_t id0 = (chamber+1)*100; + + //-------------------------------------------------------- + // Configuration for Chamber TC3/4 (Station 2) ---------- + + + fMUON->SetNsec(chamber,2); + + // cathode 0 + // type 220000 + segmentation[0]->Add(id0, slatsegB[3]); + segmentation[0]->Add(id0+ 8, slatsegB[3]); + segmentation[0]->Add(id0+50, slatsegB[3]); + segmentation[0]->Add(id0+58, slatsegB[3]); + // type 222000 + segmentation[0]->Add(id0+ 1, slatsegB[2]); + segmentation[0]->Add(id0+ 7, slatsegB[2]); + segmentation[0]->Add(id0+51, slatsegB[2]); + segmentation[0]->Add(id0+57, slatsegB[2]); + // type 122200 + segmentation[0]->Add(id0+ 2, slatsegB[1]); + segmentation[0]->Add(id0+ 6, slatsegB[1]); + segmentation[0]->Add(id0+52, slatsegB[1]); + segmentation[0]->Add(id0+56, slatsegB[1]); + // type 112200 + segmentation[0]->Add(id0+ 3, slatsegB[0]); + segmentation[0]->Add(id0+ 4, slatsegB[0]); + segmentation[0]->Add(id0+ 5, slatsegB[0]); + segmentation[0]->Add(id0+53, slatsegB[0]); + segmentation[0]->Add(id0+54, slatsegB[0]); + segmentation[0]->Add(id0+55, slatsegB[0]); + fMUON->SetSegmentationModel(chamber, 1, segmentation[0]); + + // cathode 1 + // type 220000 + segmentation[1]->Add(id0, slatsegNB[3]); + segmentation[1]->Add(id0+ 8, slatsegNB[3]); + segmentation[1]->Add(id0+50, slatsegNB[3]); + segmentation[1]->Add(id0+58, slatsegNB[3]); + // type 222000 + segmentation[1]->Add(id0+ 1, slatsegNB[2]); + segmentation[1]->Add(id0+ 7, slatsegNB[2]); + segmentation[1]->Add(id0+51, slatsegNB[2]); + segmentation[1]->Add(id0+57, slatsegNB[2]); + // type 122200 + segmentation[1]->Add(id0+ 2, slatsegNB[1]); + segmentation[1]->Add(id0+ 6, slatsegNB[1]); + segmentation[1]->Add(id0+52, slatsegNB[1]); + segmentation[1]->Add(id0+56, slatsegNB[1]); + // type 112200 + segmentation[1]->Add(id0+ 3, slatsegNB[0]); + segmentation[1]->Add(id0+ 4, slatsegNB[0]); + segmentation[1]->Add(id0+ 5, slatsegNB[0]); + segmentation[1]->Add(id0+53, slatsegNB[0]); + segmentation[1]->Add(id0+54, slatsegNB[0]); + segmentation[1]->Add(id0+55, slatsegNB[0]); + fMUON->SetSegmentationModel(chamber, 2, segmentation[1]); + + fMUON->SetResponseModel(chamber, fResponse0); + fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread + } +} + + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation4() +{ + //-------------------------------------------------------- + // Configuration for Chamber TC7/8 (Station 4) ---------- + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + AliMUONGeometrySegmentation* segmentation[2]; + + //Slats Segmentations + AliMUONSt345SlatSegmentation *slatsegB[7]; // Types of segmentation for St4 + AliMUONSt345SlatSegmentation *slatsegNB[7]; + // Bending + + Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones + for(Int_t i = 0; i < 7; i++) { + slatsegB[i] = new AliMUONSt345SlatSegmentation(1); + slatsegB[i]->SetPadSize(10.,0.5); + slatsegB[i]->SetPadDivision(ndiv); + slatsegB[i]->SetId(1); + slatsegB[i]->SetDAnod(AliMUONConstants::Pitch()); + slatsegNB[i] = new AliMUONSt345SlatSegmentation(0); + slatsegNB[i]->SetPadSize(0.713,10.); + slatsegNB[i]->SetPadDivision(ndiv); + slatsegNB[i]->SetId(1); + slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch()); + } + + Int_t n4[4] = { 0, 1, 2, 2 }; + slatsegB[0]->SetPcbBoards(n4); + slatsegB[0]->Init(0); // 0 detection element id + slatsegNB[0]->SetPcbBoards(n4); + slatsegNB[0]->Init(0); // 0 detection element id + + // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 + // (similar for Ch10) for the futur official numbering + // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 + // (similar for Ch10) actual numbering in the code to be changed in jan05 + Int_t n5[4] = { 0, 2, 2, 2 }; + slatsegB[1]->SetPcbBoards(n5); + slatsegB[1]->Init(0); // 0 detection element id + slatsegNB[1]->SetPcbBoards(n5); + slatsegNB[1]->Init(0); // 0 detection element id + + // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + Int_t n6[4] = { 0, 2, 2, 1 }; + slatsegB[2]->SetPcbBoards(n6); + slatsegB[2]->Init(0); // 0 detection element id + slatsegNB[2]->SetPcbBoards(n6); + slatsegNB[2]->Init(0); // 0 detection element id + + // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + Int_t n7[4] = { 0, 0, 3, 2 }; + slatsegB[3]->SetPcbBoards(n7); + slatsegB[3]->Init(0); // 0 detection element id + slatsegNB[3]->SetPcbBoards(n7); + slatsegNB[4]->Init(0); // 0 detection element id + + // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + Int_t n8[4] = { 0, 0, 2, 2 }; + slatsegB[4]->SetPcbBoards(n8); + slatsegB[4]->Init(0); // 0 detection element id + slatsegNB[4]->SetPcbBoards(n8); + slatsegNB[4]->Init(0); // 0 detection element id + + // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n9[4] = { 0, 0, 0, 3 }; + slatsegB[5]->SetPcbBoards(n9); + slatsegB[5]->Init(0); // 0 detection element id + slatsegNB[5]->SetPcbBoards(n9); + slatsegNB[5]->Init(0); // 0 detection element id + + // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) + // for the futur official numbering + // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) + // actual numbering in the code to be changed in jan05 + Int_t n10[4] = { 0, 0, 0, 2 }; + slatsegB[6]->SetPcbBoards(n10); + slatsegB[6]->Init(0); // 0 detection element id + slatsegNB[6]->SetPcbBoards(n10); + slatsegNB[6]->Init(0); // 0 detection element id + + + for (Int_t chamber = 6; chamber < 8; chamber++) { + + segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + // id detection elt for chamber 1 + Int_t id0 = (chamber+1)*100; + + //-------------------------------------------------------- + // Configuration for Chamber TC6/7 (Station 4) ---------- + + + fMUON->SetNsec(chamber,2); + + // cathode 0 + // type 122330 + segmentation[0]->Add(id0+ 6, slatsegB[0]); + segmentation[0]->Add(id0+56, slatsegB[0]); + + // type 112233 + segmentation[0]->Add(id0+ 5, slatsegB[1]); + segmentation[0]->Add(id0+ 7, slatsegB[1]); + segmentation[0]->Add(id0+55, slatsegB[1]); + segmentation[0]->Add(id0+57, slatsegB[1]); + + // type 112230 + segmentation[0]->Add(id0+ 4, slatsegB[2]); + segmentation[0]->Add(id0+ 8, slatsegB[2]); + segmentation[0]->Add(id0+54, slatsegB[2]); + segmentation[0]->Add(id0+58, slatsegB[2]); + + // type 222330 + segmentation[0]->Add(id0+ 3, slatsegB[3]); + segmentation[0]->Add(id0+ 9, slatsegB[3]); + segmentation[0]->Add(id0+53, slatsegB[3]); + segmentation[0]->Add(id0+59, slatsegB[3]); + + // type 223300 + segmentation[0]->Add(id0+ 2, slatsegB[4]); + segmentation[0]->Add(id0+10, slatsegB[4]); + segmentation[0]->Add(id0+52, slatsegB[4]); + segmentation[0]->Add(id0+60, slatsegB[4]); + + // type 333000 + segmentation[0]->Add(id0+ 1, slatsegB[5]); + segmentation[0]->Add(id0+11, slatsegB[5]); + segmentation[0]->Add(id0+51, slatsegB[5]); + segmentation[0]->Add(id0+61, slatsegB[5]); + + // type 330000 + segmentation[0]->Add(id0 , slatsegB[6]); + segmentation[0]->Add(id0+12, slatsegB[6]); + segmentation[0]->Add(id0+50, slatsegB[6]); + segmentation[0]->Add(id0+62, slatsegB[6]); + fMUON->SetSegmentationModel(chamber, 1, segmentation[0]); + + // cathode 1 + // type 122330 + segmentation[1]->Add(id0+ 6, slatsegNB[0]); + segmentation[1]->Add(id0+56, slatsegNB[0]); + + // type 112233 + segmentation[1]->Add(id0+ 5, slatsegNB[1]); + segmentation[1]->Add(id0+ 7, slatsegNB[1]); + segmentation[1]->Add(id0+55, slatsegNB[1]); + segmentation[1]->Add(id0+57, slatsegNB[1]); + + // type 112230 + segmentation[1]->Add(id0+ 4, slatsegNB[2]); + segmentation[1]->Add(id0+ 8, slatsegNB[2]); + segmentation[1]->Add(id0+54, slatsegNB[2]); + segmentation[1]->Add(id0+58, slatsegNB[2]); + + // type 222330 + segmentation[1]->Add(id0+ 3, slatsegNB[3]); + segmentation[1]->Add(id0+ 9, slatsegNB[3]); + segmentation[1]->Add(id0+53, slatsegNB[3]); + segmentation[1]->Add(id0+59, slatsegNB[3]); + + // type 223300 + segmentation[1]->Add(id0+ 2, slatsegNB[4]); + segmentation[1]->Add(id0+10, slatsegNB[4]); + segmentation[1]->Add(id0+52, slatsegNB[4]); + segmentation[1]->Add(id0+60, slatsegNB[4]); + + // type 333000 + segmentation[1]->Add(id0+ 1, slatsegNB[5]); + segmentation[1]->Add(id0+11, slatsegNB[5]); + segmentation[1]->Add(id0+51, slatsegNB[5]); + segmentation[1]->Add(id0+61, slatsegNB[5]); + + // type 330000 + segmentation[1]->Add(id0 , slatsegNB[6]); + segmentation[1]->Add(id0+12, slatsegNB[6]); + segmentation[1]->Add(id0+50, slatsegNB[6]); + segmentation[1]->Add(id0+62, slatsegNB[6]); + fMUON->SetSegmentationModel(chamber, 2, segmentation[1]); + + fMUON->SetResponseModel(chamber, fResponse0); + fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread + } +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation5() +{ + //-------------------------------------------------------- + // Configuration for Chamber TC9/10 (Station 5) --------- + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + AliMUONGeometrySegmentation* segmentation[2]; + + //Slats Segmentations + AliMUONSt345SlatSegmentation *slatsegB[6]; // Types of segmentation for St5 + AliMUONSt345SlatSegmentation *slatsegNB[6]; + // Bending + + Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones + for(Int_t i = 0; i < 6; i++) { + slatsegB[i] = new AliMUONSt345SlatSegmentation(1); + slatsegB[i]->SetPadSize(10.,0.5); + slatsegB[i]->SetPadDivision(ndiv); + slatsegB[i]->SetId(1); + slatsegB[i]->SetDAnod(AliMUONConstants::Pitch()); + slatsegNB[i] = new AliMUONSt345SlatSegmentation(0); + slatsegNB[i]->SetPadSize(0.713,10.); + slatsegNB[i]->SetPadDivision(ndiv); + slatsegNB[i]->SetId(1); + slatsegNB[i]->SetDAnod(AliMUONConstants::Pitch()); + } + + // Type 122330 for 900, 913 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 122330 for 906, 956 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n4[4] = { 0, 1, 2, 2 }; + slatsegB[0]->SetPcbBoards(n4); + slatsegB[0]->Init(0); // 0 detection element id + slatsegNB[0]->SetPcbBoards(n4); + slatsegNB[0]->Init(0); // 0 detection element id + + // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 + // (similar for Ch10) for the futur official numbering + // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 + // (similar for Ch10) actual numbering in the code to be changed in jan05 + Int_t n5[4] = { 0, 2, 2, 2 }; + slatsegB[1]->SetPcbBoards(n5); + slatsegB[1]->Init(0); // 0 detection element id + slatsegNB[1]->SetPcbBoards(n5); + slatsegNB[1]->Init(0); // 0 detection element id + + // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n9[4] = { 0, 0, 0, 3 }; + slatsegB[2]->SetPcbBoards(n9); + slatsegB[2]->Init(0); // 0 detection element id + slatsegNB[2]->SetPcbBoards(n9); + slatsegNB[2]->Init(0); // 0 detection element id + + // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n11[4] = { 0, 0, 3, 3 }; + slatsegB[3]->SetPcbBoards(n11); + slatsegB[3]->Init(0); // 0 detection element id + slatsegNB[3]->SetPcbBoards(n11); + slatsegNB[3]->Init(0); // 0 detection element id + + // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n12[4] = { 0, 0, 2, 3 }; + slatsegB[4]->SetPcbBoards(n12); + slatsegB[4]->Init(0); // 0 detection element id + slatsegNB[4]->SetPcbBoards(n12); + slatsegNB[4]->Init(0); // 0 detection element id + + // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) + // for the futur official numbering + // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) + // actual numbering in the code to be changed in jan05 + Int_t n13[4] = { 0, 0, 0, 4 }; + slatsegB[5]->SetPcbBoards(n13); + slatsegB[5]->Init(0); // 0 detection element id + slatsegNB[5]->SetPcbBoards(n13); + slatsegNB[5]->Init(0); // 0 detection element id + + for (Int_t chamber = 8; chamber < 10; chamber++) { + + segmentation[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + segmentation[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + // id detection elt for chamber 1 + Int_t id0 = (chamber+1)*100; + + //-------------------------------------------------------- + // Configuration for Chamber TC8/9 (Station 5) ---------- + + + fMUON->SetNsec(chamber,2); + + // cathode 0 + // type 122330 + segmentation[0]->Add(id0+ 6, slatsegB[0]); + segmentation[0]->Add(id0+56, slatsegB[0]); + + // type 112233 + segmentation[0]->Add(id0+ 4, slatsegB[1]); + segmentation[0]->Add(id0+ 5, slatsegB[1]); + segmentation[0]->Add(id0+ 7, slatsegB[1]); + segmentation[0]->Add(id0+ 8, slatsegB[1]); + segmentation[0]->Add(id0+54, slatsegB[1]); + segmentation[0]->Add(id0+55, slatsegB[1]); + segmentation[0]->Add(id0+57, slatsegB[1]); + segmentation[0]->Add(id0+58, slatsegB[1]); + + // type 333000 + segmentation[0]->Add(id0 , slatsegB[2]); + segmentation[0]->Add(id0+12, slatsegB[2]); + segmentation[0]->Add(id0+50, slatsegB[2]); + segmentation[0]->Add(id0+62, slatsegB[2]); + + // type 222333 + segmentation[0]->Add(id0+ 3, slatsegB[3]); + segmentation[0]->Add(id0+ 9, slatsegB[3]); + segmentation[0]->Add(id0+53, slatsegB[3]); + segmentation[0]->Add(id0+59, slatsegB[3]); + + // type 223330 + segmentation[0]->Add(id0+ 2, slatsegB[4]); + segmentation[0]->Add(id0+10, slatsegB[4]); + segmentation[0]->Add(id0+52, slatsegB[4]); + segmentation[0]->Add(id0+60, slatsegB[4]); + + // type 333300 + segmentation[0]->Add(id0+ 1, slatsegB[5]); + segmentation[0]->Add(id0+11, slatsegB[5]); + segmentation[0]->Add(id0+51, slatsegB[5]); + segmentation[0]->Add(id0+61, slatsegB[5]); + fMUON->SetSegmentationModel(chamber, 1, segmentation[0]); + + // cathode 1 + // type 122330 + segmentation[1]->Add(id0+ 6, slatsegNB[0]); + segmentation[1]->Add(id0+56, slatsegNB[0]); + + // type 112233 + segmentation[1]->Add(id0+ 4, slatsegNB[1]); + segmentation[1]->Add(id0+ 5, slatsegNB[1]); + segmentation[1]->Add(id0+ 7, slatsegNB[1]); + segmentation[1]->Add(id0+ 8, slatsegNB[1]); + segmentation[1]->Add(id0+54, slatsegNB[1]); + segmentation[1]->Add(id0+55, slatsegNB[1]); + segmentation[1]->Add(id0+57, slatsegNB[1]); + segmentation[1]->Add(id0+58, slatsegNB[1]); + + // type 333000 + segmentation[1]->Add(id0 , slatsegNB[2]); + segmentation[1]->Add(id0+12, slatsegNB[2]); + segmentation[1]->Add(id0+50, slatsegNB[2]); + segmentation[1]->Add(id0+62, slatsegNB[2]); + + // type 222333 + segmentation[1]->Add(id0+ 3, slatsegNB[3]); + segmentation[1]->Add(id0+ 9, slatsegNB[3]); + segmentation[1]->Add(id0+53, slatsegNB[3]); + segmentation[1]->Add(id0+59, slatsegNB[3]); + + // type 223330 + segmentation[1]->Add(id0+ 2, slatsegNB[4]); + segmentation[1]->Add(id0+10, slatsegNB[4]); + segmentation[1]->Add(id0+52, slatsegNB[4]); + segmentation[1]->Add(id0+60, slatsegNB[4]); + + // type 333300 + segmentation[1]->Add(id0+ 1, slatsegNB[5]); + segmentation[1]->Add(id0+11, slatsegNB[5]); + segmentation[1]->Add(id0+51, slatsegNB[5]); + segmentation[1]->Add(id0+61, slatsegNB[5]); + fMUON->SetSegmentationModel(chamber, 2, segmentation[1]); + + fMUON->SetResponseModel(chamber, fResponse0); + fMUON->Chamber(chamber).SetChargeCorrel(0.11); // 11% charge spread + } +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation6() +{ + // Create Trigger geometry segmentation for given chamber and cathod + + + AliMUONGeometrySegmentation *chamberSeg[2]; +// Cluster-size off + AliMUONResponseTrigger* responseTrigger0 = new AliMUONResponseTrigger; +// Cluster-size on +// AliMUONResponseTriggerV1* responseTrigger0 = new AliMUONResponseTriggerV1; + + for (Int_t chamber = 10; chamber < 14; chamber++) { + + //Trigger Segmentations + AliMUONTriggerSegmentation *trigSegX[9]; + AliMUONTriggerSegmentation *trigSegY[9]; + for(Int_t i=0; i<9; i++) { + trigSegX[i] = new AliMUONTriggerSegmentation(0); + trigSegY[i] = new AliMUONTriggerSegmentation(1); + } + + AliMUONChamber *iChamber, *iChamber1; + iChamber1 = &fMUON->Chamber(10); + iChamber = &fMUON->Chamber(chamber); + Float_t zpos1= - iChamber1->Z(); + Float_t zpos = - iChamber->Z(); + Float_t zRatio = zpos / zpos1; + + // init + Int_t nStrip[7]={0,0,0,0,0,0,0}; + Float_t stripYsize[7]={0.,0.,0.,0.,0.,0.,0.}; + Float_t stripXsize[7]={0.,0.,0.,0.,0.,0.,0.}; + + // chamber 8 cathode 0 + for (Int_t i=0; i<7; i++) nStrip[i]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[8]->Init(0,1,nStrip,stripYsize,stripXsize,0.); + + // chamber 8 cathode 1 + for (Int_t i=0; i<6; i++) nStrip[i]=8; + nStrip[6]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<7; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[8]->Init(0,1,nStrip,stripYsize,stripXsize,0.); + + // chamber 7 cathode 0 + for (Int_t i=0; i<6; i++) nStrip[i]=32; + nStrip[7]=16; + for (Int_t i=0; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[7]->Init(0,2,nStrip,stripYsize,stripXsize,0.); + + // chamber 7 cathode 1 + for (Int_t i=0; i<6; i++) nStrip[i]=8; + nStrip[6]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<7; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[7]->Init(0,2,nStrip,stripYsize,stripXsize,0.); + + // chamber 6 cathode 0 + for (Int_t i=0; i<6; i++) nStrip[i]=32; + nStrip[7]=16; + for (Int_t i=0; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[6]->Init(0,3,nStrip,stripYsize,stripXsize,0.); + + // chamber 6 cathode 1 + for (Int_t i=0; i<5; i++) nStrip[i]=16; + nStrip[5]=8; + nStrip[6]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<5; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[6]->Init(0,3,nStrip,stripYsize,stripXsize,0.); + + // chamber 5 cathode 0 + nStrip[0]=48; + for (Int_t i=1; i<3; i++) nStrip[i]=64; + for (Int_t i=3; i<6; i++) nStrip[i]=32; + nStrip[6]=16; + for (Int_t i=0; i<3; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio; + for (Int_t i=3; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[5]->Init(0,4,nStrip,stripYsize,stripXsize,AliMUONTriggerConstants::StripLength(0)*zRatio); + + // chamber 5 cathode 1 + for (Int_t i=0; i<5; i++) nStrip[i]=16; + nStrip[5]=8; + nStrip[6]=16; + stripYsize[0]=AliMUONTriggerConstants::StripLength(2)*zRatio; + for (Int_t i=1; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<5; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[5]->Init(0,4,nStrip,stripYsize,stripXsize,AliMUONTriggerConstants::StripLength(0)*zRatio); + + // chamber 4 cathode 0 + nStrip[0]=0; + for (Int_t i=1; i<3; i++) nStrip[i]=64; + for (Int_t i=3; i<6; i++) nStrip[i]=32; + nStrip[6]=16; + stripYsize[0]=0.; + for (Int_t i=1; i<3; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio; + for (Int_t i=3; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[0]=0; + stripXsize[1]=AliMUONTriggerConstants::StripLength(0)*zRatio; + for (Int_t i=2; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[4]->Init(0,5,nStrip,stripYsize,stripXsize,0.); + + // chamber 4 cathode 1 + nStrip[0]=0; + nStrip[1]=8; + for (Int_t i=2; i<5; i++) nStrip[i]=16; + nStrip[5]=8; + nStrip[6]=16; + stripYsize[0]=0.; + for (Int_t i=1; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + stripXsize[0]=0.; + for (Int_t i=1; i<5; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[4]->Init(0,5,nStrip,stripYsize,stripXsize,0.); + + // chamber 3 cathode 0 + nStrip[0]=48; + for (Int_t i=1; i<3; i++) nStrip[i]=64; + for (Int_t i=3; i<6; i++) nStrip[i]=32; + nStrip[6]=16; + for (Int_t i=0; i<3; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio; + for (Int_t i=3; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[3]->Init(0,6,nStrip,stripYsize,stripXsize,0.); + + // chamber 3 cathode 1 + for (Int_t i=0; i<5; i++) nStrip[i]=16; + nStrip[5]=8; + nStrip[6]=16; + stripYsize[0]=AliMUONTriggerConstants::StripLength(2)*zRatio; + for (Int_t i=1; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<5; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[3]->Init(0,6,nStrip,stripYsize,stripXsize,0.); + + // chamber 2 cathode 0 + for (Int_t i=0; i<6; i++) nStrip[i]=32; + nStrip[7]=16; + for (Int_t i=0; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[2]->Init(0,7,nStrip,stripYsize,stripXsize,0.); + + // chamber 2 cathode 1 + for (Int_t i=0; i<5; i++) nStrip[i]=16; + nStrip[5]=8; + nStrip[6]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<5; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[2]->Init(0,7,nStrip,stripYsize,stripXsize,0.); + + // chamber 1 cathode 0 + for (Int_t i=0; i<6; i++) nStrip[i]=32; + nStrip[7]=16; + for (Int_t i=0; i<6; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio; + stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[1]->Init(0,8,nStrip,stripYsize,stripXsize,0.); + + // chamber 1 cathode 1 + for (Int_t i=0; i<6; i++) nStrip[i]=8; + nStrip[6]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i=0; i<7; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[1]->Init(0,8,nStrip,stripYsize,stripXsize,0.); + + // chamber 0 cathode 0 + for (Int_t i=0; i<7; i++) nStrip[i]=16; + for (Int_t i=0; i<7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + for (Int_t i=0; i<6; i++) + stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio; + stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio; + trigSegX[0]->Init(0,9,nStrip,stripYsize,stripXsize,0.); + + // chamber 0 cathode 1 + for (Int_t i = 0; i < 6; i++) nStrip[i]=8; + nStrip[6]=16; + for (Int_t i = 0; i < 7; i++) + stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio; + for (Int_t i = 0; i < 7; i++) + stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio; + trigSegY[0]->Init(0,9,nStrip,stripYsize,stripXsize,0.); + + + chamberSeg[0] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + chamberSeg[1] = new AliMUONGeometrySegmentation(fMUON->Chamber(chamber).GetGeometry()); + + fMUON->SetNsec(chamber,2); + + Int_t id0 = (chamber+1)*100; + + // printf("in CreateTriggerSegmentation here 0 id0=%i \n",id0); + + for (Int_t i = 0; i < 9; i++) { + + // cathode 0 + chamberSeg[0]->Add(id0+i, trigSegX[i]); + chamberSeg[0]->Add(id0+50+i, trigSegX[i]); + fMUON->SetSegmentationModel(chamber, 1, chamberSeg[0]); + + // cathode 1 + chamberSeg[1]->Add(id0+i, trigSegY[i]); + chamberSeg[1]->Add(id0+50+i, trigSegY[i]); + fMUON->SetSegmentationModel(chamber, 2, chamberSeg[1]); + + } + + fMUON->SetResponseModel(chamber, responseTrigger0); + fMUON->Chamber(chamber).SetChargeCorrel(0); // same charge on cathodes + + + // printf("in CreateTriggerSegmentation here 1\n"); + + if (!id0) { + AliWarning(Form("Segmentation for chamber %d is not yet defined",chamber)); + return ; + } + } +} +//__________________________________________________________________________ +void AliMUONFactoryV2::Build(AliMUON* where, const char* what) +{ + // + // Construct MUON from chambers, segmentation and responses + // + + fMUON = where; + char tmp[20]; + strcpy(tmp, what); + + if (strcmp(tmp, "default")==0) { + // Set default parameters + fMUON->SetIshunt(0); + fMUON->SetMaxStepGas(0.1); + fMUON->SetMaxStepAlu(0.1); + + // Build all stations + BuildCommon(); + BuildStation1(); + BuildStation2(); + BuildStation3(); + BuildStation4(); + BuildStation5(); + BuildStation6(); + } + else + AliDebug(0,"Non default version of MUON selected. You have to construct yourself the MUON elements !!"); +} + +//__________________________________________________________________________ +void AliMUONFactoryV2::BuildStation(AliMUON* where, Int_t stationNumber) +{ + // + // Construct MUON from chambers, segmentation and responses + // + // Version 0 + // + // First define the number of planes that are segmented (1 or 2) by a call + // to SetNsec. + // Then chose for each chamber (chamber plane) the segmentation + // and response model. + // They should be equal for the two chambers of each station. In a future + // version this will be enforced. + // + + fMUON = where; + if (!fResponse0) BuildCommon(); + + switch (stationNumber) { + case 1: BuildStation1(); break; + case 2: BuildStation2(); break; + case 3: BuildStation3(); break; + case 4: BuildStation4(); break; + case 5: BuildStation5(); break; + case 6: BuildStation6(); break; + + default: AliFatal("Wrong station number"); + } +} diff --git a/MUON/AliMUONFactoryV2.h b/MUON/AliMUONFactoryV2.h new file mode 100644 index 00000000000..24be4c24275 --- /dev/null +++ b/MUON/AliMUONFactoryV2.h @@ -0,0 +1,66 @@ +#ifndef ALIMUONFACTORYV2_H +#define ALIMUONFACTORYV2_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ +// Revision of includes 07/05/2004 + +//////////////////////////////////////////////////////////// +// Factory for muon chambers, segmentations and response +// The number 2 is refering to new segmentation +// For the moment derive from AliMUONFactory +// only for used of switching from standart to V2 version +// in AliMUONv1 +//////////////////////////////////////////////////////////// + +#include +#include "AliMUONFactory.h" + +class AliMUON; +class AliMUONResponseV0; + +class AliMUONFactoryV2 : public AliMUONFactory { + + public: + AliMUONFactoryV2(); + virtual ~AliMUONFactoryV2(); + + void Build(AliMUON* where, const char* what); + void BuildStation(AliMUON* where, Int_t stationNumber); + + protected: + AliMUONFactoryV2(const AliMUONFactoryV2& rhs); + AliMUONFactoryV2& operator=(const AliMUONFactoryV2& rhs); + + private: + void BuildCommon(); + void BuildStation1(); + void BuildStation2(); + void BuildStation3(); + void BuildStation4(); + void BuildStation5(); + void BuildStation6(); + + // data members + AliMUON* fMUON; // MUON detector + AliMUONResponseV0* fResponse0; // default response + + ClassDef(AliMUONFactoryV2,0) // MUON Factory for Chambers and Segmentation +}; +#endif + + + + + + + + + + + + + + + diff --git a/MUON/AliMUONMathieson.cxx b/MUON/AliMUONMathieson.cxx index bbd26395372..3e4a5726489 100644 --- a/MUON/AliMUONMathieson.cxx +++ b/MUON/AliMUONMathieson.cxx @@ -20,12 +20,20 @@ #include "AliMUONMathieson.h" #include "AliSegmentation.h" +#include "AliMUONGeometrySegmentation.h" ClassImp(AliMUONMathieson) //__________________________________________________________________________ -AliMUONMathieson::AliMUONMathieson() + AliMUONMathieson::AliMUONMathieson() : + fSqrtKx3(0.), + fKx2(0.), + fKx4(0.), + fSqrtKy3(0.), + fKy2(0.), + fKy4(0.), + fPitch(0.) { // Default constructor @@ -56,14 +64,12 @@ void AliMUONMathieson::SetSqrtKy3AndDeriveKy2Ky4(Float_t SqrtKy3) Float_t cy1 = fKy2 * fSqrtKy3 / 4. / TMath::ATan(Double_t(fSqrtKy3)); fKy4 = cy1 / fKy2 / fSqrtKy3; } - // ------------------------------------------- - Float_t AliMUONMathieson::IntXY(AliSegmentation * segmentation) { // Calculate charge on current pad according to Mathieson distribution // - const Float_t kInversePitch = 1/fPitch; + const Float_t kInversePitch = 1/fPitch; // // Integration limits defined by segmentation model // @@ -85,13 +91,31 @@ Float_t AliMUONMathieson::IntXY(AliSegmentation * segmentation) return Float_t(4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))* fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1))); } +// ------------------------------------------- +Float_t AliMUONMathieson::IntXY(Int_t idDE, AliMUONGeometrySegmentation* segmentation) +{ +// Calculate charge on current pad according to Mathieson distribution +// using Detection elt + + const Float_t kInversePitch = 1./fPitch; +// +// Integration limits defined by segmentation model +// + Float_t xi1, xi2, yi1, yi2; + segmentation->IntegrationLimits(idDE, xi1,xi2,yi1,yi2); + xi1=xi1*kInversePitch; + xi2=xi2*kInversePitch; + yi1=yi1*kInversePitch; + yi2=yi2*kInversePitch; +// +// The Mathieson function + Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1); + Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2); + Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1); + Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2); - - - - - - - - + + return Float_t(4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))* + fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1))); +} diff --git a/MUON/AliMUONMathieson.h b/MUON/AliMUONMathieson.h index 044782b7b23..1bc76e01c7b 100644 --- a/MUON/AliMUONMathieson.h +++ b/MUON/AliMUONMathieson.h @@ -7,6 +7,7 @@ // Revision of includes 07/05/2004 class AliSegmentation; +class AliMUONGeometrySegmentation; class AliMUONMathieson { @@ -38,6 +39,7 @@ class AliMUONMathieson void SetKy4(Float_t p1) {fKy4 = p1;}; // Charge disintegration Float_t IntXY(AliSegmentation * segmentation); + Float_t IntXY(Int_t id, AliMUONGeometrySegmentation* segmentation); ClassDef(AliMUONMathieson,1) // Implementation of Mathieson response protected: diff --git a/MUON/AliMUONResponse.h b/MUON/AliMUONResponse.h index 4bd92b0cd21..c50a0ccf03d 100644 --- a/MUON/AliMUONResponse.h +++ b/MUON/AliMUONResponse.h @@ -10,6 +10,7 @@ class TF1; class AliSegmentation; +class AliMUONGeometrySegmentation; class AliMUONTransientDigit; class AliMUONResponse : public TObject @@ -52,15 +53,17 @@ class AliMUONResponse : public TObject // Get anode cathode Pitch virtual Float_t Pitch() const {return 1.;} // Set the charge correlation - virtual void SetChargeCorrel(Float_t) {return;} + virtual void SetChargeCorrel(Float_t) {return;} // Get the charge correlation virtual Float_t ChargeCorrel() const {return 1.;} // // Chamber response methods // Pulse height from scored quantity (eloss) - virtual Float_t IntPH(Float_t) {return 1.;} + virtual Float_t IntPH(Float_t) {return 1.;} // Charge disintegration virtual Float_t IntXY(AliSegmentation *) {return 1.;} + virtual Float_t IntXY(Int_t, AliMUONGeometrySegmentation*) {return 1.;} + // Noise, zero-suppression, adc saturation //virtual Int_t DigitResponse(Int_t ) {return kTRUE;} virtual Int_t DigitResponse(Int_t , diff --git a/MUON/AliMUONResponseV0.cxx b/MUON/AliMUONResponseV0.cxx index 662cb00c52b..438f4d6d5a7 100644 --- a/MUON/AliMUONResponseV0.cxx +++ b/MUON/AliMUONResponseV0.cxx @@ -20,19 +20,24 @@ #include "AliMUONResponseV0.h" #include "AliSegmentation.h" - +#include "AliMUONGeometrySegmentation.h" ClassImp(AliMUONResponseV0) //__________________________________________________________________________ AliMUONResponseV0::AliMUONResponseV0() - : AliMUONResponse() + : AliMUONResponse() { // Default constructor + fMathieson = new AliMUONMathieson(); fChargeCorrel = 0; } - + //__________________________________________________________________________ +AliMUONResponseV0::~AliMUONResponseV0() +{ + delete fMathieson; +} //__________________________________________________________________________ void AliMUONResponseV0::SetSqrtKx3AndDeriveKx2Kx4(Float_t SqrtKx3) { @@ -40,10 +45,7 @@ void AliMUONResponseV0::SetSqrtKx3AndDeriveKx2Kx4(Float_t SqrtKx3) // in the X direction, perpendicular to the wires, // and derive the Mathieson parameters K2 ("fKx2") and K4 ("fKx4") // in the same direction - fSqrtKx3 = SqrtKx3; - fKx2 = TMath::Pi() / 2. * (1. - 0.5 * fSqrtKx3); - Float_t cx1 = fKx2 * fSqrtKx3 / 4. / TMath::ATan(Double_t(fSqrtKx3)); - fKx4 = cx1 / fKx2 / fSqrtKx3; + fMathieson->SetSqrtKx3AndDeriveKx2Kx4(SqrtKx3); } //__________________________________________________________________________ @@ -53,12 +55,9 @@ void AliMUONResponseV0::SetSqrtKy3AndDeriveKy2Ky4(Float_t SqrtKy3) // in the Y direction, along the wires, // and derive the Mathieson parameters K2 ("fKy2") and K4 ("fKy4") // in the same direction - fSqrtKy3 = SqrtKy3; - fKy2 = TMath::Pi() / 2. * (1. - 0.5 * fSqrtKy3); - Float_t cy1 = fKy2 * fSqrtKy3 / 4. / TMath::ATan(Double_t(fSqrtKy3)); - fKy4 = cy1 / fKy2 / fSqrtKy3; + fMathieson->SetSqrtKy3AndDeriveKy2Ky4(SqrtKy3); } - + //__________________________________________________________________________ Float_t AliMUONResponseV0::IntPH(Float_t eloss) { // Calculate charge from given ionization energy loss @@ -73,35 +72,22 @@ Float_t AliMUONResponseV0::IntPH(Float_t eloss) } return charge; } -// ------------------------------------------- - + //------------------------------------------- Float_t AliMUONResponseV0::IntXY(AliSegmentation * segmentation) { -// Calculate charge on current pad according to Mathieson distribution -// - const Float_t kInversePitch = 1/fPitch; -// -// Integration limits defined by segmentation model -// - Float_t xi1, xi2, yi1, yi2; - segmentation->IntegrationLimits(xi1,xi2,yi1,yi2); - xi1=xi1*kInversePitch; - xi2=xi2*kInversePitch; - yi1=yi1*kInversePitch; - yi2=yi2*kInversePitch; -// -// The Mathieson function - Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1); - Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2); - - Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1); - Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2); - - - return Float_t(4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))* - fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1))); + // Calculate charge on current pad according to Mathieson distribution + + return fMathieson->IntXY(segmentation); + } + //------------------------------------------- +Float_t AliMUONResponseV0::IntXY(Int_t idDE, AliMUONGeometrySegmentation* segmentation) +{ + // Calculate charge on current pad according to Mathieson distribution + return fMathieson->IntXY(idDE, segmentation); +} + //------------------------------------------- Int_t AliMUONResponseV0::DigitResponse(Int_t digit, AliMUONTransientDigit* /*where*/) { // add white noise and do zero-suppression and signal truncation diff --git a/MUON/AliMUONResponseV0.h b/MUON/AliMUONResponseV0.h index 517f8fed7f0..efd2ce9b418 100644 --- a/MUON/AliMUONResponseV0.h +++ b/MUON/AliMUONResponseV0.h @@ -7,12 +7,13 @@ // Revision of includes 07/05/2004 #include "AliMUONResponse.h" +#include "AliMUONMathieson.h" -class AliMUONResponseV0 : public AliMUONResponse +class AliMUONResponseV0 : public AliMUONResponse { public: AliMUONResponseV0(); - virtual ~AliMUONResponseV0(){} + virtual ~AliMUONResponseV0(); // // Configuration methods // @@ -44,37 +45,42 @@ class AliMUONResponseV0 : public AliMUONResponse // Get zero suppression threshold virtual Int_t ZeroSuppression() const {return fZeroSuppression;} - // Set anode cathode Pitch - virtual Float_t Pitch() const {return fPitch;} - // Get anode cathode Pitch - virtual void SetPitch(Float_t p1) {fPitch=p1;}; // Set the charge correlation virtual void SetChargeCorrel(Float_t correl){fChargeCorrel = correl;} // Get the charge correlation virtual Float_t ChargeCorrel() const {return fChargeCorrel;} + + + // Set anode cathode Pitch + virtual Float_t Pitch() const {return fMathieson->Pitch();} + // Get anode cathode Pitch + virtual void SetPitch(Float_t p1) {fMathieson->SetPitch(p1);}; + // Set Mathieson parameters - // Mathieson \sqrt{Kx3} and derived Kx2 and Kx4 - virtual void SetSqrtKx3AndDeriveKx2Kx4(Float_t SqrtKx3); + // Mathieson \sqrt{Kx3} and derived Kx2 and Kx4 + // passing pointer to class Mathieson for backward compatibility + virtual void SetSqrtKx3AndDeriveKx2Kx4(Float_t SqrtKx3); // Mathieson \sqrt{Kx3} - virtual void SetSqrtKx3(Float_t p1) {fSqrtKx3=p1;}; + virtual void SetSqrtKx3(Float_t p1) {fMathieson->SetSqrtKx3(p1);}; // Mathieson Kx2 - virtual void SetKx2(Float_t p1) {fKx2=p1;}; + virtual void SetKx2(Float_t p1) {fMathieson->SetKx2(p1);}; // Mathieson Kx4 - virtual void SetKx4(Float_t p1) {fKx4=p1;}; + virtual void SetKx4(Float_t p1) {fMathieson->SetKx4(p1);}; // Mathieson \sqrt{Ky3} and derived Ky2 and Ky4 virtual void SetSqrtKy3AndDeriveKy2Ky4(Float_t SqrtKy3); // Mathieson \sqrt{Ky3} - virtual void SetSqrtKy3(Float_t p1) {fSqrtKy3=p1;}; + virtual void SetSqrtKy3(Float_t p1) {fMathieson->SetSqrtKy3(p1);}; // Mathieson Ky2 - virtual void SetKy2(Float_t p1) {fKy2=p1;}; + virtual void SetKy2(Float_t p1) {fMathieson->SetKy2(p1);}; // Mathieson Ky4 - virtual void SetKy4(Float_t p1) {fKy4=p1;}; + virtual void SetKy4(Float_t p1) {fMathieson->SetKy4(p1);}; // // Chamber response methods // Pulse height from scored quantity (eloss) virtual Float_t IntPH(Float_t eloss); // Charge disintegration virtual Float_t IntXY(AliSegmentation * segmentation); + virtual Float_t IntXY(Int_t idDE, AliMUONGeometrySegmentation* segmentation); // Noise, zero-suppression, adc saturation virtual Int_t DigitResponse(Int_t digit, AliMUONTransientDigit* where); @@ -89,13 +95,15 @@ class AliMUONResponseV0 : public AliMUONResponse Int_t fZeroSuppression; // Zero suppression threshold Float_t fChargeCorrel; // amplitude of charge correlation on 2 cathods // is RMS of ln(q1/q2) - Float_t fSqrtKx3; // Mathieson Sqrt(Kx3) - Float_t fKx2; // Mathieson Kx2 - Float_t fKx4; // Mathieson Kx4 = Kx1/Kx2/Sqrt(Kx3) - Float_t fSqrtKy3; // Mathieson Sqrt(Ky3) - Float_t fKy2; // Mathieson Ky2 - Float_t fKy4; // Mathieson Ky4 = Ky1/Ky2/Sqrt(Ky3) - Float_t fPitch; // anode-cathode pitch + AliMUONMathieson* fMathieson; // pointer to mathieson fct + +/* Float_t fSqrtKx3; // Mathieson Sqrt(Kx3) */ +/* Float_t fKx2; // Mathieson Kx2 */ +/* Float_t fKx4; // Mathieson Kx4 = Kx1/Kx2/Sqrt(Kx3) */ +/* Float_t fSqrtKy3; // Mathieson Sqrt(Ky3) */ +/* Float_t fKy2; // Mathieson Ky2 */ +/* Float_t fKy4; // Mathieson Ky4 = Ky1/Ky2/Sqrt(Ky3) */ +/* Float_t fPitch; // anode-cathode pitch */ }; #endif diff --git a/MUON/AliMUONSDigitizerv1.cxx b/MUON/AliMUONSDigitizerv1.cxx index 7cb3eddeb95..598e41c6366 100644 --- a/MUON/AliMUONSDigitizerv1.cxx +++ b/MUON/AliMUONSDigitizerv1.cxx @@ -55,7 +55,7 @@ AliMUONSDigitizerv1::~AliMUONSDigitizerv1() } //------------------------------------------------------------------------ -void AliMUONSDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) +void AliMUONSDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) { // Derived to write to the s-digit tree TreeS. diff --git a/MUON/AliMUONSt12QuadrantSegmentation.cxx b/MUON/AliMUONSt12QuadrantSegmentation.cxx index 4ee2bc72d45..ecc2ef59908 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.cxx +++ b/MUON/AliMUONSt12QuadrantSegmentation.cxx @@ -39,6 +39,8 @@ #include "AliMUON.h" #include "AliMUONChamber.h" #include "AliLog.h" +#include "AliMpFiles.h" +#include ClassImp(AliMUONSt12QuadrantSegmentation) @@ -74,6 +76,15 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( fCorrA(0) { // Normal constructor + + // set path to mapping data files + if (!gSystem->Getenv("MINSTALL")) { + TString dirPath = gSystem->Getenv("ALICE_ROOT"); + dirPath += "/MUON/mapping"; + AliMpFiles::Instance()->SetTopPath(dirPath); + gSystem->Setenv("MINSTALL", dirPath.Data()); + //cout << "AliMpFiles top path set to " << dirPath << endl; + } AliMpReader r(stationType, planeType); fSector = r.BuildSector(); diff --git a/MUON/AliMUONSt345SlatSegmentation.cxx b/MUON/AliMUONSt345SlatSegmentation.cxx index dc47c4b19ad..6ae77e473fb 100644 --- a/MUON/AliMUONSt345SlatSegmentation.cxx +++ b/MUON/AliMUONSt345SlatSegmentation.cxx @@ -30,10 +30,34 @@ #include "AliMUONSt345SlatSegmentation.h" #include "AliLog.h" -//___________________________________________ ClassImp(AliMUONSt345SlatSegmentation) +AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation() + : AliMUONVGeometryDESegmentation(), + fBending(0), + fId(0), + fDpx(0), + fDpy(0), + fNpx(999999), + fNpy(999999), + fWireD(0.0), + fXhit(0.), + fYhit(0.), + fIx(0), + fIy(0), + fX(0.), + fY(0.), + fIxmin(0), + fIxmax(0), + fIymin(0), + fIymax(0) +{ + // default constructor + +} + +//___________________________________________ AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(Bool_t bending) : AliMUONVGeometryDESegmentation(), fBending(bending), @@ -415,7 +439,7 @@ void AliMUONSt345SlatSegmentation::Init(Int_t detectionElementId) // printf("\n Initialise Segmentation SlatModule \n"); - printf(" fBending: %d \n",fBending); + // printf(" fBending: %d \n",fBending); fDxPCB=40; fDyPCB=40; diff --git a/MUON/AliMUONSt345SlatSegmentation.h b/MUON/AliMUONSt345SlatSegmentation.h index bd671227bdc..1dbedb04ddc 100644 --- a/MUON/AliMUONSt345SlatSegmentation.h +++ b/MUON/AliMUONSt345SlatSegmentation.h @@ -21,6 +21,7 @@ class TArrayI; class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation { public: + AliMUONSt345SlatSegmentation(); AliMUONSt345SlatSegmentation(Bool_t bending); virtual ~AliMUONSt345SlatSegmentation(); diff --git a/MUON/AliMUONTriggerSegmentation.cxx b/MUON/AliMUONTriggerSegmentation.cxx index 2184e5aea73..dc492a46e79 100644 --- a/MUON/AliMUONTriggerSegmentation.cxx +++ b/MUON/AliMUONTriggerSegmentation.cxx @@ -24,7 +24,14 @@ //___________________________________________ ClassImp(AliMUONTriggerSegmentation) - +AliMUONTriggerSegmentation::AliMUONTriggerSegmentation() + : AliMUONVGeometryDESegmentation(), + fBending(0), + fId(0) +{ + // default constructor +} +//___________________________________________ AliMUONTriggerSegmentation::AliMUONTriggerSegmentation(Bool_t bending) : AliMUONVGeometryDESegmentation(), fBending(!bending), diff --git a/MUON/AliMUONTriggerSegmentation.h b/MUON/AliMUONTriggerSegmentation.h index 02f9cbef147..bfa2c896f48 100644 --- a/MUON/AliMUONTriggerSegmentation.h +++ b/MUON/AliMUONTriggerSegmentation.h @@ -21,6 +21,7 @@ class TArrayI; class AliMUONTriggerSegmentation : public AliMUONVGeometryDESegmentation { public: + AliMUONTriggerSegmentation(); AliMUONTriggerSegmentation(Bool_t bending); virtual ~AliMUONTriggerSegmentation(); diff --git a/MUON/AliMUONv1.cxx b/MUON/AliMUONv1.cxx index e2d36039e52..2d87e0ac81f 100644 --- a/MUON/AliMUONv1.cxx +++ b/MUON/AliMUONv1.cxx @@ -30,7 +30,7 @@ #include "AliConst.h" #include "AliMUONChamber.h" #include "AliMUONConstants.h" -#include "AliMUONFactory.h" +#include "AliMUONFactoryV2.h" #include "AliMUONHit.h" #include "AliMUONTriggerCircuit.h" #include "AliMUONGeometryBuilder.h" @@ -80,8 +80,6 @@ AliMUONv1::AliMUONv1(const char *name, const char *title) // Standard onstructor // By default include all stations - AliMUONFactory factory; - factory.Build(this, title); fStepSum = new Float_t [AliMUONConstants::NCh()]; fDestepSum = new Float_t [AliMUONConstants::NCh()]; @@ -167,29 +165,59 @@ void AliMUONv1::CreateMaterials() //___________________________________________ void AliMUONv1::Init() -{ - // - // Initialize Tracking Chambers - // +{ AliDebug(1,"Start Init for version 1 - CPC chamber type"); Int_t i; - for (i=0; iInit(); - } - - // + + + // // Initialize geometry // fGeometryBuilder->InitGeometry(); - AliDebug(1,"Finished Init for version 1 - CPC chamber type"); + AliDebug(1,"Finished Init for version 1 - CPC chamber type"); + + AliMUONFactory* factory = 0x0; + + if (fSegmentationType == 1) { + factory = new AliMUONFactory(); + printf("\n Old Segmentation \n"); + } + + if (fSegmentationType == 2) { + factory = new AliMUONFactoryV2(); + printf("\n New Segmentation \n"); + } - //cp - AliDebug(1,"Start Init for Trigger Circuits"); - for (i=0; iInit(i); + factory->Build(this, "default"); + + // + // Initialize segmentation + // + if (!fSegmentationType) { + AliFatal("No Segmentation Type defined."); + return; + } + + if (fSegmentationType == 1) { + for (i=0; iInit(); } - AliDebug(1,"Finished Init for Trigger Circuits"); - //cp + + if (fSegmentationType == 2) { + for (i=0; iInit(fSegmentationType);// new segmentation + } + + if (fSegmentationType == 1) { + //cp + AliDebug(1,"Start Init for Trigger Circuits"); + for (i=0; iInit(i); + AliDebug(1,"Finished Init for Trigger Circuits"); + } + + + } //__________________________________________________________________ diff --git a/MUON/Config.C b/MUON/Config.C index f0fa3ca259e..7ce5eb3ed72 100644 --- a/MUON/Config.C +++ b/MUON/Config.C @@ -157,8 +157,9 @@ void Config(char directory[100]="", char option[6]="param") // If align = true, the detection elements transformations // are taken from the input files and not from the code - // ((AliMUONv1*)MUON)->SetStepManagerVersionDE(true); +// ((AliMUONv1*)MUON)->SetStepManagerVersionDE(true); // To save detection element Id in the hits + MUON->SetSegmentationType(1);// default wise to old (1), new (2) //MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON)); MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON)); diff --git a/MUON/MUONsimLinkDef.h b/MUON/MUONsimLinkDef.h index 3ff9b07d161..ffff61fc8fe 100644 --- a/MUON/MUONsimLinkDef.h +++ b/MUON/MUONsimLinkDef.h @@ -6,6 +6,7 @@ #pragma link C++ class AliMUONv0+; #pragma link C++ class AliMUONFactory+; +#pragma link C++ class AliMUONFactoryV2+; #pragma link C++ class AliMUONSt1Segmentation+; #pragma link C++ class AliMUONSt12QuadrantSegmentation+; diff --git a/MUON/libMUONsim.pkg b/MUON/libMUONsim.pkg index 64990d4d3c4..ae821cb0087 100644 --- a/MUON/libMUONsim.pkg +++ b/MUON/libMUONsim.pkg @@ -2,6 +2,7 @@ SRCS:= AliMUONv0.cxx \ AliMUONFactory.cxx \ + AliMUONFactoryV2.cxx \ AliMUONSt1Segmentation.cxx \ AliMUONSt12QuadrantSegmentation.cxx \ AliMUONSt1Response.cxx \ -- 2.43.0