]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUON.cxx
added initialization fNofLVWithSD
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
index d60b27812752bd37a3ff74ff3439fd756adbd7fc..c009aee4f40c36ae58a20926dc26dc7cacadcb3b 100644 (file)
  **************************************************************************/
 /*
 $Log$
+Revision 1.33  2000/10/09 14:01:57  morsch
+Unused variables removed.
+
+Revision 1.32  2000/10/06 09:08:10  morsch
+Built geometry includes slat geometry for event display.
+
+Revision 1.31  2000/10/02 21:28:08  fca
+Removal of useless dependecies via forward declarations
+
+Revision 1.30  2000/10/02 16:58:29  egangler
+Cleaning of the code :
+-> coding conventions
+-> void Streamers
+-> some useless includes removed or replaced by "class" statement
+
+Revision 1.29  2000/07/28 13:49:38  morsch
+SetAcceptance defines inner and outer chamber radii according to angular acceptance.
+Can be used for simple acceptance studies.
+
+Revision 1.28  2000/07/22 16:43:15  morsch
+Same comment as before, but now done correctly I hope (sorry it's Saturday evening)
+
+Revision 1.27  2000/07/22 16:36:50  morsch
+Change order of indices in creation (new) of xhit and yhit
+
+Revision 1.26  2000/07/03 11:54:57  morsch
+AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
+The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
+
 Revision 1.25  2000/06/29 12:34:09  morsch
 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
 it usable with any other geometry class. The link to the object to which it belongs is
@@ -118,6 +147,7 @@ Log message added
 #include <TTUBE.h>
 #include <TBRIK.h>
 #include <TRotMatrix.h>
+#include <TGeometry.h>
 #include <TNode.h> 
 #include <TTree.h> 
 #include <TRandom.h> 
@@ -144,6 +174,7 @@ Log message added
 #include "AliMUONRawCluster.h"
 #include "AliMUONLocalTrigger.h"
 #include "AliMUONGlobalTrigger.h"
+#include "AliMUONTriggerCircuit.h"
 #include "AliHitMap.h"
 #include "AliMUONHitMapA1.h"
 #include "AliMUONChamberTrigger.h"
@@ -188,6 +219,9 @@ AliMUON::AliMUON()
    fNLocalTrigger   = 0;
    fLocalTrigger    = 0;
    fNLocalTrigger   = 0;
+   fAccMin          = 0.;
+   fAccMax          = 0.;   
+   fAccCut          = kFALSE;
 }
  
 //___________________________________________
@@ -225,19 +259,12 @@ AliMUON::AliMUON(const char *name, const char *title)
        (*fRawClusters)[i] = new TClonesArray("AliMUONRawCluster",10000); 
        fNrawch[i]=0;
    }
-   cout << " here " << "\n";
 
    fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);    
    fNGlobalTrigger = 0;
    fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);    
    fNLocalTrigger = 0;
 
-//   
-// Transport angular cut
-   fAccCut=0;
-   fAccMin=2;
-   fAccMax=9;
-
    SetMarkerColor(kRed);
 //
 //
@@ -272,6 +299,7 @@ AliMUON::AliMUON(const char *name, const char *title)
            chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
 //
            chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
+//          Set chamber inner and outer radius to default
            chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
            chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
 //
@@ -284,6 +312,10 @@ AliMUON::AliMUON(const char *name, const char *title)
 //
    fMaxIterPad   = 0;
    fCurIterPad   = 0;
+//
+   fAccMin          = 0.;
+   fAccMax          = 0.;   
+   fAccCut          = kFALSE;
 
    // cp new design of AliMUONTriggerDecision
    fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
@@ -393,7 +425,8 @@ void AliMUON::BuildGeometry()
 {
     TNode *node, *nodeF, *top, *nodeS;
     const int kColorMUON  = kBlue;
-    const int kColorMUON2 = kGreen; 
+    const int kColorMUON2 = kYellow;
+    const int kColorMUON3 = kBlue; 
     //
     top=gAlice->GetGeometry()->GetNode("alice");
 // MUON
@@ -416,7 +449,7 @@ void AliMUON::BuildGeometry()
     Float_t hole=102.;          // x-y hole around beam pipe for trig. chambers
     Float_t zscale;            // scaling parameter trigger chambers
     Float_t halfx, halfy;   
-    char nameChamber[9], nameSense[9], nameFrame[9], nameNode[8];
+    char nameChamber[9], nameSense[9], nameFrame[9], nameNode[9];
     char nameSense1[9], nameSense2[9];    
     for (Int_t i=0; i<7; i++) {
        for (Int_t j=0; j<2; j++) {
@@ -439,7 +472,7 @@ void AliMUON::BuildGeometry()
            sprintf(nameSense1,"S1_MUON%d",id);
            sprintf(nameSense2,"S2_MUON%d",id);
            sprintf(nameFrame,"F_MUON%d",id);   
-           if (i<5) {                        // tracking chambers
+           if (i<3) {                        // tracking chambers
                rmin = kDmin[i]/2.-3;
                rmax = kDmax[i]/2.+3;
                new TTUBE(nameChamber,"Mother","void",rmin,rmax,0.25,1.);
@@ -476,6 +509,60 @@ void AliMUON::BuildGeometry()
                sprintf(nameNode,"MUON%d",600+id);   
                nodeF = new TNode(nameNode,"Frame3",frMUON,0,-dr,0,rot270,"");
                nodeF->SetLineColor(kColorMUON);
+           } else if (i == 3 || i == 4) {
+               Int_t   npcb[7] = {7, 7, 6, 6, 5, 4, 3};
+               char nameSlat[9];
+               
+               Float_t xpos=4.;
+               Float_t ypos1=-0.75+20.;
+               Float_t ypos2= 0.75-20.;
+               
+               new TBRIK(nameChamber,"Mother","void",340,340,5.);
+               top->cd();
+               sprintf(nameNode,"MUON%d",100+id);
+               node = new TNode(nameNode,"Chambernode",nameChamber,0,0,zpos,"");
+               node->SetLineColor(kBlack);
+               fNodes->Add(node);
+               TNode* nodeSlat;
+               Int_t color;
+               
+               for (Int_t j=0; j<7; j++)
+               {
+                   sprintf(nameSlat,"SLAT%d",100*id+j);
+                   new TBRIK(nameSlat,"Slat Module","void",20.*npcb[j],20.,0.25);
+                   node->cd();
+                   xpos=20.*npcb[j]+4;
+                   if (j==0) xpos+=30;
+
+                   color =  TMath::Even(j) ? kColorMUON2 : kColorMUON3;
+                   
+                   sprintf(nameNode,"SLAT%d",100*id+j);
+                   nodeSlat = 
+                       new TNode(nameNode,"Slat Module",nameSlat,xpos,ypos1,0,"");
+                   nodeSlat->SetLineColor(color);
+
+                   node->cd();
+                   sprintf(nameNode,"SLAT%d",100*id+j+7);
+                   nodeSlat = 
+                       new TNode(nameNode,"Slat Module",nameSlat,-xpos,ypos1,0,"");
+                   nodeSlat->SetLineColor(color);
+                   
+                   color =  TMath::Even(j) ? kColorMUON3 : kColorMUON2;
+                   sprintf(nameNode,"SLAT%d",100*id+j+14);
+                   nodeSlat = 
+                       new TNode(nameNode,"Slat Module",nameSlat,xpos,ypos2,0,"");
+                   nodeSlat->SetLineColor(color);
+
+                   node->cd();
+                   sprintf(nameNode,"SLAT%d",100*id+j+21);
+                   nodeSlat = 
+                       new TNode(nameNode,"Slat Module",nameSlat,-xpos,ypos2,0,"");
+                   nodeSlat->SetLineColor(color);
+                   
+                   ypos1+=38.5;
+                   ypos2-=38.5;
+               }
+               
            } else { 
                zscale=zpos/kCz[5];
                Float_t xsize=kDmin[i]*zscale;
@@ -795,11 +882,23 @@ void AliMUON::SetMaxDestepAlu(Float_t p1)
     fMaxDestepAlu=p1;
 }
 //___________________________________________
-void AliMUON::SetMuonAcc(Bool_t acc, Float_t angmin, Float_t angmax)
+void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
 {
    fAccCut=acc;
-   fAccMin=angmin;
-   fAccMax=angmax;
+   fAccMin=angmin*TMath::Pi()/180;
+   fAccMax=angmax*TMath::Pi()/180;
+   Int_t ch;
+   if (acc) {
+       for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
+          // Loop over 2 chambers in the station
+          for (Int_t stCH = 0; stCH < 2; stCH++) {
+              ch = 2 * st + stCH;
+//         Set chamber inner and outer radius according to acceptance cuts
+              Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
+              Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
+          } // chamber loop
+       } // station loop
+   }
 }
 //___________________________________________
 void   AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
@@ -847,10 +946,13 @@ void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit,
     clhits[0]=fNhits+1;
 //
 //
+//    if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss );
+    
+
     ((AliMUONChamber*) (*fChambers)[idvol])
        ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust);
     Int_t ic=0;
-    
+//    if (idvol == 6) printf("\n nnew  %d \n", nnew);
 //
 //  Add new clusters
     for (Int_t i=0; i<nnew; i++) {
@@ -968,15 +1070,15 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
        TTree *treeH = gAlice->TreeH();
        Int_t ntracks =(Int_t) treeH->GetEntries();
        Int_t jj;
-       Float_t ** xhit = new Float_t * [2];
-       for (jj=0; jj<2; jj++) xhit[jj] = new Float_t  [AliMUONConstants::NCh()];
-       Float_t ** yhit = new Float_t * [2];
-       for (jj=0; jj<2; jj++) yhit[jj] = new Float_t  [AliMUONConstants::NCh()];
-       
+
+       Float_t ** xhit = new Float_t * [AliMUONConstants::NCh()];
+       for (jj=0; jj<AliMUONConstants::NCh(); jj++) xhit[jj] = new Float_t[2];
+       Float_t ** yhit = new Float_t * [AliMUONConstants::NCh()];
+       for (jj=0; jj<AliMUONConstants::NCh(); jj++) yhit[jj] = new Float_t[2];
+
        for (Int_t track=0; track<ntracks; track++) {
            gAlice->ResetHits();
            treeH->GetEvent(track);
-           
 //
 //   Loop over hits
            for(AliMUONHit* mHit=(AliMUONHit*)pMUON->FirstHit(-1); 
@@ -985,14 +1087,15 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
            {
                Int_t   nch   = mHit->fChamber-1;  // chamber number
                if (nch > AliMUONConstants::NCh()-1) continue;
+//             if (nch > 9) continue;
                iChamber = &(pMUON->Chamber(nch));
                 // new 17.07.99
                if (addBackground) {
 
                    if (mHit->fParticle == kMuonPlus 
                        || mHit->fParticle == kMuonMinus) {
-                       xhit[nch][nmuon[nch]]=mHit->fX;
-                       yhit[nch][nmuon[nch]]=mHit->fY;
+                       xhit[nch][nmuon[nch]]=mHit->X();
+                       yhit[nch][nmuon[nch]]=mHit->Y();
                        nmuon[nch]++;
                        if (nmuon[nch] >2) printf("nmuon %d\n",nmuon[nch]);
                    }
@@ -1012,14 +1115,15 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
                    Int_t ipx      = mPad->fPadX;       // pad number on X
                    Int_t ipy      = mPad->fPadY;       // pad number on Y
                    Int_t iqpad    = Int_t(mPad->fQpad);// charge per pad
+//                 printf("\n Pad: %d %d %d %d", ipx, ipy, cathode,nch);
 //
 //
                    
                    if (cathode != (icat+1)) continue;
                    // fill the info array
-                   Float_t thex, they, thez;
+//                 Float_t thex, they, thez;
                    segmentation=iChamber->SegmentationModel(cathode);
-                   segmentation->GetPadC(ipx,ipy,thex,they,thez);
+//                 segmentation->GetPadC(ipx,ipy,thex,they,thez);
 //                 Float_t rpad=TMath::Sqrt(thex*thex+they*they);
 //                 if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
 
@@ -1060,8 +1164,8 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
                        Int_t lastEntry=trlist->GetLast();
                        TVector *pTrack=(TVector*)trlist->At(lastEntry);
                        TVector &ptrk=*pTrack;
-                       Int_t lastTrack=Int_t(ptrk(0));
-                       Int_t lastCharge=Int_t(ptrk(1));
+                       Int_t lastTrack  = Int_t(ptrk(0));
+                       Int_t lastCharge = Int_t(ptrk(1));
                        if (lastTrack==track) {
                            lastCharge+=iqpad;
                            trlist->RemoveAt(lastEntry);
@@ -1077,8 +1181,8 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
                            for (Int_t tr=0;tr<nptracks;tr++) {
                                TVector *ppTrack=(TVector*)trlist->At(tr);
                                TVector &pptrk=*ppTrack;
-                               trk[tr]=Int_t(pptrk(0));
-                               chtrk[tr]=Int_t(pptrk(1));
+                               trk[tr]   = Int_t(pptrk(0));
+                               chtrk[tr] = Int_t(pptrk(1));
                            }
                        } // end if nptracks
                    } //  end if pdigit
@@ -1108,10 +1212,10 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
                    Int_t   nch   = mHit->fChamber-1;  // chamber number
                    if (nch >9) continue;
                    iChamber = &(pMUON->Chamber(nch));
-                   Int_t rmin = (Int_t)iChamber->RInner();
-                   Int_t rmax = (Int_t)iChamber->ROuter();
-                    Float_t xbgr=mHit->fX;
-                   Float_t ybgr=mHit->fY;
+//                 Int_t rmin = (Int_t)iChamber->RInner();
+//                 Int_t rmax = (Int_t)iChamber->ROuter();
+                    Float_t xbgr=mHit->X();
+                   Float_t ybgr=mHit->Y();
                    Bool_t cond=kFALSE;
                    
                    for (Int_t imuon =0; imuon < nmuon[nch]; imuon++) {
@@ -1135,11 +1239,13 @@ void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,T
                        Int_t iqpad    = Int_t(mPad->fQpad);// charge per pad
 
                        if (cathode != (icat+1)) continue;
-                       Float_t thex, they, thez;
-                       segmentation=iChamber->SegmentationModel(cathode);
-                       segmentation->GetPadC(ipx,ipy,thex,they,thez);
-                       Float_t rpad=TMath::Sqrt(thex*thex+they*they);
-                       if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
+                       printf("\n Pad: %d %d %d", ipx, ipy, cathode);
+                       
+//                     Float_t thex, they, thez;
+//                     segmentation=iChamber->SegmentationModel(cathode);
+//                     segmentation->GetPadC(ipx,ipy,thex,they,thez);
+//                     Float_t rpad=TMath::Sqrt(thex*thex+they*they);
+//                     if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
                        new((*pAddress)[countadr++]) TVector(2);
                        TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
                        trinfo(0)=-1;  // tag background