FlyoDoc_2011 Pisa 2011 by GmP --- 011
Public Member Functions | Public Attributes

DevStraw Class Reference

Inheritance diagram for DevStraw:
DevRtRt DevRt Device

List of all members.

Public Member Functions

 DevStraw ()
 =========================================
int SimulaDev ()
int Set_tubo (int nb, double DX, double hit_time, int *tubo, double *T0, double *Ts, double *Tmp, int *Tcc)
void Set_tubi_errors (int itb, double *Ts, double *T0)
int Mscatter (Particella *, double)
void Prgeom ()
void Get_wire ()
 *********************************************************************

Public Attributes

DevStrawupstraw
DevStrawnextstraw
Tubiparm TbParm
int tubiseen
int flag_pileup
int ntub1
int tubo1 [16]
int use_tubo1 [16]
int toc_tubo1 [16]
int ntub2
int tubo2 [16]
int use_tubo2 [16]
int toc_tubo2 [16]
int ntub3
int tubo3 [16]
int use_tubo3 [16]
int toc_tubo3 [16]
int ntub4
int tubo4 [16]
int use_tubo4 [16]
int toc_tubo4 [16]
double ts_tubo1 [16]
double t0_tubo1 [16]
double tmp_tubo1 [16]
double ts_tubo2 [16]
double t0_tubo2 [16]
double tmp_tubo2 [16]
double ts_tubo3 [16]
double t0_tubo3 [16]
double tmp_tubo3 [16]
double ts_tubo4 [16]
double t0_tubo4 [16]
double tmp_tubo4 [16]
int nwire
float Wirecoor [16]
float Wiredtim [16]
float Wiret0tim [16]
float Wiret0stim [16]
float Wiredtempo [16]

Detailed Description

Definition at line 55 of file devstraw.h.


Constructor & Destructor Documentation

DevStraw::DevStraw ( )

=========================================

Definition at line 27 of file devstraw.cpp.

                   : DevRtRt()
{
    devtype=TypDevStraw;
    devclass="Straw Chamber";
    Gout<<"\n\n < "<<nome <<" > Dev Id "<<idev<<" Device type <"<<devclass<<"> typ "<<devtype;
    static DevStraw *laststraw = 0;
    if ( laststraw== 0 ) FirstStraw=this;
    else             laststraw->nextstraw = this;    // linking
    upstraw=laststraw;
    laststraw = this;
    this->nextstraw = 0;    // end linking

    for (int i=0;i<16;i++) {
        Wirecoor[i]=Wiredtim[i]=Wiret0tim[i]=Wiredtempo[i]=Wiret0stim[i]=0.;
    };

// attenzione questa istruzione va corretta a seconda del path...da aggiustare
//  char *Direttor={"../../mslibrary"};
    string Direttor= "../../mslibrary";

    Gout<<"\n Multiple Scattering data for dev "<< nome;

    if ( StrTetPip!=0 ) Gout<<" allready done.";
    else
    {

        Strawlib ( Direttor,string("pionplus"),StrTetPip, StrProbPip );
        Strawlib ( Direttor,string("muon" ),   StrTetMup, StrProbMup );
        Strawlib ( Direttor,string("positron"),StrTetElep,StrProbElep );


        /*    for ( int i=0;i<1200;i++ )
            {
              Gout<<"\n "<<i<<" " <<StrProbPip[10][i]<<" " <<StrProbPip[40][i]<<" " <<StrProbPip[70][i];
            }
        */

    }
    tubiseen=0;
// test of this particular measured buffer dimension
    int dim= working_buffer;
    if (dim<MemoryBuffer)
    {
        dim=MemoryBuffer;
        Gout<<"\n In device ** "<<nome <<" **  measur_buffer adjusted to ==> "<<dim;
    }


}

Member Function Documentation

void DevStraw::Get_wire ( )

*********************************************************************

int FiloValida(int *flags, double *Tubo,double *T0, double *Ts);

int FiloValida(int,int *flags, int *Tubo,double *T0, double *Ts);

Definition at line 500 of file devstraw.cpp.

{
    int  ix=0;
    double Xwire[16],Xwiredtim[16],Xwiredtrailing[16],Xwiretrailsom[16],Xwiredtempo[16];
    int piano[16];
    for (int i=0;i<16;i++) use_tubo1[i]=use_tubo2[i]=use_tubo3[i]=use_tubo4[i]=-1;
    for (int i=0;i<16;i++)
    {
        Xwire[i]=Xwiredtim[i]=Xwiredtrailing[i]=Xwiretrailsom[i]=.0;
        Xwiredtempo[i]=-300.;
    }

    double trailing0=0.;

    int ntb,b3,b4;
    tempo_trigger=0.0;
    long Tnano= evento_.Gen.tempo;
    tempo_trigger=double((Tnano/trigger_res)*trigger_res) + trigger_res/2.;

//    cout<<"\n\n Start Ev "<<evento_.Gen.Event<<"  "<<nome<<"  mhit "<<mhit;
//     cout<<"\n Primo piano "<<ntub1;

// primo piano
    for (int i=0;i<ntub1;i++)
    {

        TbParm.Reset();

        trailing0=t0_tubo1[i]-tempo_trigger;
        if (fabs(trailing0)>tubo_res) continue;  // qui si butta se siamo fuori tempo massimo....
        TbParm.ntbc=TbParm.ntb=ntb =tubo1[i];
        TbParm.tlead0=ts_tubo1[i]-tempo_trigger;  // tempo di arrivo del segnale al filo centrale del tubo
        if (TbParm.tlead0<0.0||TbParm.tlead0>155.) continue;


//test on plane 4
        b4=TbParm.FiloValida(ntub4,use_tubo4,tubo4,t0_tubo4,ts_tubo4);

//test on plane 3
        b3=TbParm.FiloValida(ntub3,use_tubo3,tubo3,t0_tubo3,ts_tubo3);

// test segno if defined..
        if (TbParm.segno==0.0) continue;
        use_tubo1[i]=ntb;
        Xwire[ix]=TbParm.ntb*passo+XTref1+TbParm.segno*TbParm.tlead0/conv2time;
        Xwiredtim[ix]=TbParm.totdriftsav;
        Xwiredtrailing[ix]=TbParm.trailingsav-trailing0;
        Xwiretrailsom[ix]=TbParm.trailingsav+trailing0;
        Xwiredtempo[ix]=evento_.Gen.tempo-tmp_tubo1[i];
        piano[ix]=ntb+1000*b3+1000000*b4;

        ix++;
    }

// secondo piano
//cout<<"\n Secondo piano "<<ntub2;

    for (int i=0;i<ntub2;i++)
    {

        TbParm.Reset();

        trailing0=t0_tubo2[i]-tempo_trigger;
        if (fabs(trailing0)>tubo_res) continue;  // qui si butta se siamo fuori tempo massimo....
        TbParm.ntb=ntb =tubo2[i];
        TbParm.tlead0=ts_tubo2[i]-tempo_trigger;  // tempo di arrivo del segnale al filo centrale del tubo
        if (TbParm.tlead0<0.0||TbParm.tlead0>155.) continue;


        //test on plane 3
        TbParm.ntbc=ntb;
        b3=TbParm.FiloValida(ntub3,use_tubo3,tubo3,t0_tubo3,ts_tubo3);

//test on plane 4
        TbParm.ntbc=ntb+1;
        b4=TbParm.FiloValida(ntub4,use_tubo4,tubo4,t0_tubo4,ts_tubo4);



// test segno if defined..
        if (TbParm.segno==0.0) continue;
        use_tubo2[i]=ntb;
        Xwire[ix]=TbParm.ntb*passo+XTref2+TbParm.segno*TbParm.tlead0/conv2time;
        Xwiredtim[ix]=TbParm.totdriftsav;
        Xwiredtrailing[ix]=TbParm.trailingsav-trailing0;
        Xwiretrailsom[ix]=TbParm.trailingsav+trailing0;
        Xwiredtempo[ix]=evento_.Gen.tempo-tmp_tubo2[i];
        piano[ix]=-(ntb+1000*b3+1000000*b4);
        ix++;

    }

    nwire=ix;

    for (int i=0;i<nwire;i++)
    {
        Wirecoor[i]=Xwire[i];
        Wiredtim[i]=Xwiredtim[i];
        Wiret0tim[i]=Xwiredtrailing[i];
        Wiret0stim[i]=Xwiretrailsom[i];
        Wiredtempo[i]=Xwiredtempo[i];
    }

    // verifico se l'evento nella camera è stato costruito con pileup

    flag_pileup=0;

    for (int i=0;i<nwire;i++)
    {
        if (Wiredtempo[i]!=0)
            flag_pileup++;
    }




//if (nwire!=mhit)
    if (nwire< -10)
    {
        cout<<"\n ****** Ev "<<evento_.Gen.Event<<"  "<<nome<<"  mhit "<<mhit<< " nwire "<<nwire<<"\n";

        for ( int k=0;k<mhit;k++ )
        {
            double X1= M_Hits[k].Xdev.x ;
            cout<<" "<<M_Hits[k].pnome<<" "<<X1;
        }


        cout<<"\n "<< ntub1<<" "<<ntub2<<" " <<ntub3<< " "<<ntub4;
        for (int tb=0;tb<ntub1;tb++) cout<<"\n hit1 "<< tubo1[tb]<<" dt "<<  ts_tubo1[tb]-evento_.Gen.tempo;
        for (int tb=0;tb<ntub2;tb++) cout<<"\n hit2 "<< tubo2[tb]<<" dt "<<  ts_tubo2[tb]-evento_.Gen.tempo;
        for (int tb=0;tb<ntub3;tb++) cout<<"\n hit3 "<< tubo3[tb]<<" dt "<<  ts_tubo3[tb]-evento_.Gen.tempo;
        for (int tb=0;tb<ntub4;tb++) cout<<"\n hit4 "<< tubo4[tb]<<" dt "<<  ts_tubo4[tb]-evento_.Gen.tempo;

        cout<<"\n Dev "<<nome<<" nwire "<<nwire<< " x: ";
        for (int ix=0;ix<nwire;ix++)

        {
            cout<<" [ "<<piano[ix]<<" "<<Xwire[ix]<<" tt "<<Xwiredtim[ix]<<" ] ";
        }

        cout<<"\n  coordinate M_Hit ";
        for (int i=0;i<mhit;i++)
            cout<< "  "<<M_Hits[i].Xdev.x;


        cout<<endl;
    }


}
int DevStraw::Mscatter ( Particella pr,
double  tratok 
) [virtual]

qui pioni elettroni e muoni positivi tra 6 e 65 GeV/c

Reimplemented from Device.

Definition at line 92 of file devstraw.cpp.

{
//-------------------------------------------------
//              M S C A T T E R
//-------------------------------------------------

// =======  Multiple Scattering Routine =====
// at t e n z i o n e ... aggiustare per magnete e sfera!!!


    if (Scatter==0) return 0;    // no multiple scattering required
    lrad=nowpos?lradb:lradi;

    if (lrad <= 0.0             ||   // no multiscat.
            pr->charg == 0.0           ||   // no charge
            tratok < 0.001          )       // no crossed space
        return 0;
//===============================
    qvet Pprev;
    double randx,randy;
    int libMom,jbin,passx,passy;
    double libProb,dthx,dthy;
    int pplus,positron,muon;


    if ( pr->P.norma<=6. || pr->P.norma>65. ) {
        return  Device::Mscatter ( pr,tratok );
    }

    if ( pr->Get_Nome() !=Pip && pr->Get_Nome() !=Elep && pr->Get_Nome() !=Mup )
    {
        return  Device::Mscatter ( pr,tratok );
    }


// Multiple Scattering library implementation
    // No gaussian  multiple scattering for Pip,Elep,and Mup

    // Define type of particle
    pplus = positron = muon = 0;
    if ( !strcmp ( pr->Get_Nome(),"pip" ) )  pplus = 1;
    if ( !strcmp ( pr->Get_Nome(),"elep" ) ) positron = 1;
    if ( !strcmp ( pr->Get_Nome(),"mup" ) )  muon = 1;


    // Smear the coordinate according to the MSlib
    libProb = 0;
    passx = passy = 0;
    dthx = dthy = 0;
    randx = Pran();
    randy = Pran();
    libMom = ( int ) pr->P.norma;
    for ( jbin=0;jbin<1200;jbin++ )
    {
        if ( pplus )    libProb = StrProbPip[libMom][jbin];
        if ( positron ) libProb = StrProbElep[libMom][jbin];
        if ( muon )     libProb = StrProbMup[libMom][jbin];
//               libProb = libMSProb[libMom][jbin];
        if ( !passx && libProb>randx )
        {
            if ( pplus )    dthx = StrTetPip[jbin];
            if ( positron ) dthx = StrTetElep[jbin];
            if ( muon )     dthx = StrTetMup[jbin];
//                dthx = msTheta[jbin];
            passx = 1;
        }
        if ( !passy && libProb>randy )
        {
            if ( pplus )    dthy =  StrTetPip[jbin];
            if ( positron ) dthy =  StrTetElep[jbin];
            if ( muon )     dthy =  StrTetMup[jbin];
//                dthy = msTheta[jbin];
            passy = 1;
        }
    }
//            cout << dthx << " " << dthy << endl;
    pr->P.x += pr->P.norma*dthx;
    pr->P.y += pr->P.norma*dthy;
    pr->Vers=pr->P.Verso();

//-------------------------------------------------
//              D e g r a d o

// =======  Multiple Scattering energy loss =====

// do nothing if ....
    if ( Perdita ==0 )        return 0;    // no loss

    if ( nowpos==0 )       {
        Ro=Roint;
        Dedx=Dedxint;
    }
    else if ( nowpos==-1 ) {
        Ro=Robuc;
        Dedx=Dedxbuc;
    }
    else return 0;

    if ( Ro  == 0.0 )         return 0;  // no densita'
    if ( Dedx == 0.0 )        return 0;  // no Dedx

//  p=Puls.norma;
    double p=0.;
    double persa=0.0;
    persa= Dedx*tratok; //in GeV
    double ee=pr->P.e;
    if ( persa>= ( ee-pr->massa ) )
    {
        persa=ee-pr->massa;
        p=0.0;
        ee=pr->massa;
    }
    else
    {
        ee-=persa;
        p = sqrt ( ee*ee - pr->massa*pr->massa );
    }


    gvet Pscat=pr->Vers*p;
    pr->P.x=Pscat.x;
    pr->P.y=Pscat.y;
    pr->P.z=Pscat.z;
    pr->P.z = ee;
    pr->P.Norma();
    if ( Debugon==1 )
        Gout<<" de="<<setw ( 6 ) <<persa<<" P "<<setw ( 6 ) <<pr->P.norma;

// Gout<<"\n  Msc  "<<pr->nome<<" gnhit "<< gnhit<<" ghcir "<<ghcir;
    if ( rivela==0 ) Hits[nhit].e_rivela+=persa; // attenzione nello hit generato...
    return 0;
}
int DevStraw::SimulaDev ( ) [virtual]

simulaziome fili toccati

Reimplemented from Device.

Definition at line 335 of file devstraw.cpp.

{


    tubiseen=ntub1=ntub2=ntub3=ntub4=0;
    for (int i=0;i<16;i++)     toc_tubo1[i]=toc_tubo2[i]=toc_tubo3[i]=toc_tubo4[i]=0;




// calcolo dei delle straw attraversate
//
// Ricordo alcuni parametri geometrici
// passo = 1.76 cm uguale alla distanza tra i centri delle straw su di uno stesso piano
// Distanza in zeta del piano 2 dal piano 1  d12= sqrt(3/4)*passo=1.524 cm
// Distanza del piano 3 dal piano 1:         d13= sqrt(3/4)*(2*passo+pass4) =3.429 cm
// Distanza del piano 4 dal piano 1:         d14= sqrt(3/4)*(3*passo+pass4) =4.953 cm

// centro in x dello straw tube  più a destra  del piano 1: Xt= -basecm
// centro in x dello straw tube  più a destra  del piano 2: Xt= -104.56+passo/2  = -103.68 cm
// centro in x dello straw tube  più a destra  del piano 3: Xt= -104.56+passo/4 = -104.12 cm
// centro in x dello straw tube  più a destra  del piano 4: Xt= -104.56-passo/4 = -105.00 cm


    nwire=0;
    double X1=0.,X2=0.,X3=0.,X4=0., tgxz=0.;
//  cout<<"\n Device "<<nome<<"  mhit "<<mhit<<"\n";

    for ( int k=0;k<mhit;k++ )
    {
// attenzione si lavora nel sistema del dev...
        gvet verso=Lab2Dev(M_Hits[k].Vers);
        tgxz=verso.x/verso.z;
        X1= M_Hits[k].Xdev.x ;
        double tempo_hit=M_Hits[k].tempo;
        //      cout<<"\n\nhit Ev "<<evento_.Gen.Event<<"  "<<M_Hits[k].pnome<<" x "<<X1<<" tgz "<<tgxz;


        ntub1=Set_tubo(ntub1,X1-XTref1,tempo_hit,tubo1,t0_tubo1,ts_tubo1,tmp_tubo1,toc_tubo1);
        X2= X1 + tgxz*d12;
        ntub2=Set_tubo(ntub2,X2-XTref2,tempo_hit,tubo2,t0_tubo2,ts_tubo2,tmp_tubo2,toc_tubo2);
        X3= X1 + tgxz*d13;
        ntub3=Set_tubo(ntub3,X3-XTref3,tempo_hit,tubo3,t0_tubo3,ts_tubo3,tmp_tubo3,toc_tubo3);
        X4= X1 + tgxz*d14;
        ntub4=Set_tubo(ntub4,X4-XTref4,tempo_hit,tubo4,t0_tubo4,ts_tubo4,tmp_tubo4,toc_tubo4);

    }
    // set the errors....
    // prima di definire gli errori occorre conoscere come viene esattamente generato
    // il segnale di trailing e tleading.

    Set_tubi_errors(ntub1, ts_tubo1, t0_tubo1);
    Set_tubi_errors(ntub2, ts_tubo2, t0_tubo2);
    Set_tubi_errors(ntub3, ts_tubo3, t0_tubo3);
    Set_tubi_errors(ntub4, ts_tubo4, t0_tubo4);

    tubiseen=ntub1+ntub2+ntub3+ntub4;
    Get_wire();

    return 1;

}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables