|
FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
#include <device.h>
Public Member Functions | |
| Device () | |
| void | Leggi_schede_dev () |
| char * | Get_Nome () |
| char * | Get_NickName () |
| int | Get_Idev () |
| const char * | Get_Vede (int i) |
| void | Make_working_buffer (int) |
| void | Make_measur_buffer (int) |
| int | Fill_Default () |
| virtual void | Reset_RootData () |
| int | Get_DatiOut () |
| double | Get_Zsize () |
| void | Change_sign_Field () |
| void | Set_Field (double B) |
| void | Set_Rivela (Particella *) |
| void | Reset_Dev () |
| void | Reset_Pos () |
| void | Dev_summary () |
| void | SpiaPr (char *, int, int, double) |
| void | Set_X_dev (gvet gv) |
| gvet & | Get_X_dev () |
| gvet & | Get_Centro () |
| gvet & | Get_Cface () |
| gvet & | Get_Lout () |
| gvet & | Get_Lin () |
| double | Get_Kik () |
| void | Get_Materiali () |
| void | GetWindowHits (double) |
| virtual int | SimulaDev () |
| virtual gvet & | Lab2Dev (gvet &) |
| virtual gvet & | Lab2cDev (gvet &) |
| virtual gvet & | Dev2Lab (gvet &) |
| virtual gvet & | Devc2Lab (gvet &) |
| virtual int | Posizione () |
| virtual double | CamEster () |
| virtual double | CamInter () |
| virtual double | CamBuco () |
| virtual void | ScrvColpi (Particella *) |
| virtual int | Traccia (Particella *) |
| ================ T R A C C I A ==================================== | |
| virtual gvet & | Get_Field (gvet &x) |
| virtual gvet & | Get_Field () |
| virtual int | Mscatter (Particella *, double) |
| virtual void | DataSmear () |
| virtual double | Msperdita (double) |
| virtual double | Get_Res () |
| virtual int | Get_Structinfo () |
| void | PrgeomId () |
| virtual void | Prgeom () |
| void | Get_Pointers () |
| Device * | Get_Pointer (const char *) |
| Device * | Get_camm (Particella *) |
Public Attributes | |
| int | maxBrems |
| int | maxPair |
| int | Brem_done |
| int | Pair_done |
| int | gnhit |
| int | ghcir |
| int | ghit_last |
| int | nhit |
| int | mhit |
| int | Start_Hit |
| double | eDev |
| Bufdev * | Hits |
| int | working_buffer |
| int | circular_buffer |
| Bufdev * | G_Hits |
| Bufdev * | M_Hits |
| int | hit_recorded |
| int * | index |
| int * | mid |
| int * | structinfo |
| int * | mdead |
| unsigned long long * | devstory |
| float | emDev |
| float * | mxd |
| float * | myd |
| float * | mzd |
| float * | mdd |
| float * | me |
| float * | mxl |
| float * | myl |
| float * | mzl |
| float * | gpx |
| float * | gpy |
| float * | gpz |
| float * | ge |
| double * | dtemp |
| Particella * | pr_dev |
| int | nowpos |
| int | prevpos |
| int | accedi |
| int | escludi |
| int | rivela |
| int | Idsee |
| int | wrout |
| int | Tot_seen |
| int | Part_hit [40] |
| Device * | up |
| Device * | next |
Protected Attributes | |
| int | devtype |
| std::string | devclass |
| int | idev |
| char | nome [9] |
| char | nickname [9] |
| const char * | fun |
| int | nvede |
| int | assorb [30] |
| const char * | vede [30] |
| int | registra |
| gvet | Centro |
| gvet | Centrin |
| gvet | Cface |
| gvet | Nx |
| gvet | Ny |
| gvet | Nz |
| gvet | Lout |
| gvet | Lin |
| gvet | Fortax |
| gvet | X_dev |
| gvet | V_dev |
| double | OpenSector |
| double | Rqsize |
| std::string | mattint |
| std::string | mattbuc |
| int | Zint |
| int | Zbuc |
| double | Aint |
| double | Abuc |
| double | liint |
| double | libuc |
| double | Roint |
| double | Robuc |
| double | Dedxint |
| double | Dedxbuc |
| double | lradi |
| double | lradb |
| double | lrad |
| double | nrad |
| double | Ro |
| double | Dedx |
| double | lint |
| double | reckik |
| gvet | Field |
| int | campo |
| double | Bref |
| double | Dbref |
| gvet | Field_sav |
| double | time_now |
| double | t_dead_mem |
| double | cost |
| double | sint |
| double | sinf |
| double | cosf |
| double | txplane |
| double | typlane |
| double | tet0 |
| double | xplane |
| double | yplane |
| double | z1 |
| double | z2 |
| double | Last_distq |
| double | dcs |
| double | path |
| double | tratto |
| double | camm |
| int | posok |
| int | pos |
Friends | |
| class | Particella |
| class | TriggerBox |
| class | Radiografia |
device è la classe base di tutte la classi che descrivono i rivelatori. Per convenzione le classi dei rivelatori iniziano con "dev". In device appaiono:
| Device::Device | ( | ) |
Class base per i rivelatori. Il costruttore Device() legge i file ( di solito di tipo .app) degli apparati con le definizioni geometriche e dei materiali dei rivelatori.
Definition at line 35 of file device.cpp.
{
working_buffer=MemoryBuffer;
Make_working_buffer ( working_buffer );
Make_measur_buffer ( working_buffer );
// create e new device
tot_device++;
idev = tot_device;
devtype=TypDevice; //=0
if ( last_device== 0 ) Apparato=this;
else last_device->next = this; // linking
up=last_device;
last_device = this;
this->next = 0; // end linking
// default orientation and zero setting
Nx.setvn ( 1.,0.,0. );
Ny.setvn ( 0.,1.,0. );
Nz.setvn ( 0.,0.,1. );
Tot_seen=0;
for ( int i=0;i<40;i++ ) Part_hit[i]=0;
nhit =ghcir= gnhit=nvede = -1;
ghit_last=mhit=0;
nowpos=prevpos=6;
wrout=accedi=escludi=rivela=Zint=Zbuc=0;
registra=1;
campo=-1;
reckik=-1. ; // reconstruction Kik non defined
mattint="";
mattbuc="";
maxBrems=maxPair=0; //if >1 enable bremsstrhalung and pair production
Brem_done=Pair_done=0;
eDev=t_dead_mem =time_now=Ro =Dedx =0.0;
Roint=Robuc=Dedxint=Dedxbuc=0.0;
Aint=Abuc=lradi = lradb=lrad= 0.0;
fun=Nodef; // set default function at None...
// legge i dati di definizione del dev
Leggi_schede_dev();
}
| int Device::Fill_Default | ( | ) |
Se il Pipeline non è attivo si caricano i dati da G_Hits in M_Hits in successione sincrona con la generazione.
Definition at line 674 of file device.cpp.
| Device * Device::Get_camm | ( | Particella * | pr | ) |
Procedura per calcolare il cammino libero di una particella prima di colpire la superficie, esterna o interna di un device. Ritorna il puntatore al device, il cammino libero e definisce due flags di posizione: uno relativo alla posizione di provenienza ed uno alla posizione attuale.
Vedi la tabella in cui gli indici mostrano la posizione della particella prima di iniziare la tracciatura (prevpos) e la posizione attuale (nowpos) rispetto al device restituito.
| prevpos | nowpos | definizione |
| 3 | 1 | da posizione non definita (appena nata) ora esterna al dev |
| 1 | 1 | da posizione esterna ancora esterna |
| 3 | 0 | da posizione non def ora interna. |
| 1 | 0 | da posizione esterna ora interna |
| 0 | 0 | da posizione interna ancora interna |
| 0 | -1 | da posizione interna ora nel buco |
| -1 | -1 | da posizione nel buco ancora nel buco |
In particolare il significato dell'indice:
Definition at line 1282 of file device.cpp.
{
// double tratto,path; ...in device.h
// int posok,pos;
// double Last_distq=1.e+12;
Device *Dvk,*Dev;
//
path=1.e+10;
Dvk=0;
Dev=this; // device di partenza per la loop
posok=3;
while ( Dev!=0 )
{
if ( Dev->accedi>0|| Dev->escludi>0||
Dev->rivela<0 ) // dev non visibile o non vede
{
if ( Dev == Devloop ) Devloop = Devloop->next; // aggiorno Devloop
Dev=Dev->next;
continue;
}
//--------------------=================----------------
Dev->pr_dev=pr;
Dev->X_dev=Dev->Lab2cDev ( pr->X ); // trasla al centro dev e ruota
Dev->V_dev=Dev->Lab2Dev ( pr->Vers ); // routa il versore.... att. aggiornato!
Dev->X_dev.Norma();
if ( Dev->X_dev.normaq>Dev->Rqsize ) // test grossolano ma veloce per dev esterno
{
dcs=Dev->X_dev%Dev->V_dev; // dist. dal centro dev proiet. sul cammino
if ( dcs>=0.0 ) // dev superato
{
if ( Dev == Devloop ) Devloop = Devloop->next; // aggiorno Devloop
Dev->accedi=13;
Dev=Dev->next;
continue;
}
else if ( Dev->X_dev.normaq-dcs*dcs>Dev->Rqsize )
{
// Dev->accedi=12; //no! se lo scattering o un campo cambia la direzione di volo!
Dev=Dev->next;
continue;
}
}
// check position carefullly.....
pos = Dev->Posizione();
// if ( pr->idm==14 ) Dev->SpiaPr ( " Posiz ", 49,49 ,-99.);
if ( pos==1 ) //Esterno
{
// calcolo il cammino per colpire il dev.....
Dev->tratto=Dev->CamEster();
// if ( pr->idm==14 ) Dev->SpiaPr ( " Esterno ", 49,49 , Dev->tratto);
if ( Dev->tratto>Dev->X_dev.norma ) Dev->tratto=Dev->X_dev.norma;
// if ( pr->idm==14 ) Dev->SpiaPr ( " Ester ", 48,48 );
if ( Dev->tratto<0.0001 ) // Dev not accessible or just crossed
{
Dev->accedi = 14;
if ( Dev == Devloop ) Devloop = Devloop->next; // aggiorno Devloop
Dev=Dev->next;
continue;
}
else if ( Dev->tratto<path ) // viaggia verso il dev...
{
path=Dev->tratto+0.01;
if ( posok>0 )
{
Dvk=Dev;
posok=pos;
}
}
}
else if ( pos==0 ) //Interno ..
{
// calcolo la dist dalle parete di uscita. o da un dev interno
Dev->tratto=Dev->CamInter();
if ( Dev->tratto<path ) path=Dev->tratto+0.01; // corretto
Dvk=Dev;
posok=pos;
// if ( pr->idm==14 ) Dev->SpiaPr ( " Inter ", 48,48 );
//qui cambiato??????????????????????????????????????
// break; se non ci sono device interni si potrebbe uscire subito
}
else if ( pos==-1 ) //nel buco... anxhe qui attenzione ai dev interni ......
{
Dev->tratto=Dev->CamBuco();
if ( Dev->nowpos>-1 )
{
Dvk=Dev;
posok=pos;
}
if ( Dev->tratto<path ) // corretto
{
path=Dev->tratto+0.01;
if ( posok>-1 )
{
Dvk=Dev;
posok=pos;
}
}
}
Dev=Dev->next;
} // end loop
if ( Dvk!=0 )
{
Dvk->pr_dev=pr; // ricordo l'indirizzo della particella in tracing..
Dvk->camm= path+CEPSI;
Dvk->prevpos=Dvk->nowpos;
Dvk->nowpos=posok;
// Dvk->SpiaPr ( " Scelt ", 2,4, Dvk->camm );
}
return Dvk;
}
| int Device::Get_DatiOut | ( | ) |
Copia i dati ricostruiti (flags, coordinate e parametri cinematici), da M.Hits nelle variabili per il file Root di uscita.
che sono i buffer utili alla fine evento per riempire gli istogrammi in root. Vedi la procedura Outnt().
Attenzione questa routine deve essere chiamata dopo DataSmear() e SimulaDev().
Se SimulaDev() è dummy... mhit deve essere comunque definito correttamente; Vedi Fill_Default().
Definition at line 687 of file device.cpp.
{
hit_recorded=mhit;
emDev=0.;
if ( mhit>0 )
{
// test on the total hits
if ( mhit>working_buffer )
{
Gout<<"\n Ev "<< Eventi_Fatti<<" <Measur_buffer> too low in "<<nome<< " Detected hits: "<<mhit
<< " cut to "<<working_buffer;
mhit=working_buffer;
}
hit_recorded=mhit;
for ( int hts=0;hts<hit_recorded;hts++ )
{
index[hts]=M_Hits[hts].id;
mid[hts]=M_Hits[hts].idm;
mdead[hts]=M_Hits[hts].idead;
structinfo[hts]=M_Hits[hts].structinfo;
devstory[hts]=M_Hits[hts].devstory;
M_Hits[hts].Xdev.putv ( mxd[hts],myd[hts],mzd[hts] );
mdd[hts]= M_Hits[hts].Xdev.XYNorma();
me[hts]=M_Hits[hts].e_rivela;
M_Hits[hts].Xlab.putv ( mxl[hts],myl[hts],mzl[hts] );
M_Hits[hts].Pdev.putq ( gpx[hts],gpy[hts],gpz[hts],ge[hts] );
dtemp[hts]=M_Hits[hts].tempo-evento_.Gen.tempo;
emDev+=me[hts];
}
}
return hit_recorded;
}
| Device * Device::Get_Pointer | ( | const char * | word | ) |
Trova il pointer di un particolare device, dato il nome.
Vedi anche la procedura in overloading Get_Pointer ().
Definition at line 881 of file device.cpp.
{
Device *dv,*dvok=0;
dv=Apparato;
while ( dv!=0 )
{
if ( dv->escludi==0 &&
strcmp ( dv->nome,word ) ==0 ) dvok= dv;
dv=dv->next;
}
Gout<<"\n Device "<< setw ( 9 ) <<word<<" pointer "<< ( dvok?" found":" === not === found or excluded" );
return dvok;
}
| void Device::Get_Pointers | ( | ) |
Definisce alcuni pointer di device ritenuti utili nell'eseguire più velocemente la simulazione.
Attenzione questi pointers sono di tipo device e quindi puntano alle variabili definite in device.h e non conoscono i parametri definiti nelle classi derivate, mentre possono chiamare le procedure virtuali di ciascuna classe derivata e via questi i parmetri delle classe derivate.
Definition at line 776 of file device.cpp.
{
// to be updated according to the device names....
// get dev pointers
Gout<<"\n Device::Get_pointers() : get the device pointers to speed up the simulation..."
<<"\n The user must adjust the device labels occording to names as defined in .app file \n";
collo= Apparato->Get_Pointer ( "Collo" );
xch02= Apparato->Get_Pointer ( "XCH02" );
spione0 = Apparato->Get_Pointer ( "spione0" );
spione1 = Apparato->Get_Pointer ( "spione1" );
vtappo = Apparato->Get_Pointer ( "Vtappo" );
dectubo= Apparato->Get_Pointer ( "dectubo" );
kabs1= (Devkabes*) Apparato->Get_Pointer ( "Spibes1" );
kabs2= (Devkabes*) Apparato->Get_Pointer ( "Spibes2" );
kabs3= (Devkabes*) Apparato->Get_Pointer ( "Spibes3" );
giga1= (DevGtk*) Apparato->Get_Pointer ( "Gtk1" );
giga2= (DevGtk*) Apparato->Get_Pointer ( "Gtk2" );
giga3= (DevGtk*) Apparato->Get_Pointer ( "Gtk3" );
cedar= (DevCedar*) Apparato->Get_Pointer ( "cedar" );
mgb1 = Apparato->Get_Pointer ( "MCB80" ); // magnet pointers of acromat 2
mgb2 = Apparato->Get_Pointer ( "MCB84" );
mgb3 = Apparato->Get_Pointer ( "MCB95" );
mgb4 = Apparato->Get_Pointer ( "MCB97" );
mgb5 = Apparato->Get_Pointer ( "MDX99" );
Chanti = (DevChanti*) Apparato->Get_Pointer ( "chanti" );
// get anticounter pointers...
anti[0]= (DevLav*) Apparato->Get_Pointer ( "Ant1" );
anti[1]= (DevLav*) Apparato->Get_Pointer ( "Ant2" );
anti[2]= (DevLav*) Apparato->Get_Pointer ( "Ant3" );
anti[3]= (DevLav*) Apparato->Get_Pointer ( "Ant4" );
anti[4]= (DevLav*) Apparato->Get_Pointer ( "Ant5" );
anti[5]= (DevLav*) Apparato->Get_Pointer ( "Ant6" );
anti[6]= (DevLav*) Apparato->Get_Pointer ( "Ant7" );
anti[7]= (DevLav*) Apparato->Get_Pointer ( "Ant8" );
anti[8]= (DevLav*) Apparato->Get_Pointer ( "Ant9" );
anti[9]= (DevLav*) Apparato->Get_Pointer ( "Ant10" );
anti[10]= (DevLav*) Apparato->Get_Pointer ( "Ant11" );
anti[11]= (DevLav*) Apparato->Get_Pointer ( "Ant12" );
Cam1= (DevMwc*) Apparato->Get_Pointer ( "Cam1" );
Cam2= (DevMwc*) Apparato->Get_Pointer ( "Cam2" );
Cam3= (DevMwc*) Apparato->Get_Pointer ( "Cam3" );
Cam4= (DevMwc*) Apparato->Get_Pointer ( "Cam4" );
Rich= (DevRich*) Apparato->Get_Pointer ( "Rich" );
St1x= (DevStraw*) Apparato->Get_Pointer ( "St1x" ); // la coordinata è parallela ai fili attenzione
St1y= (DevStraw*) Apparato->Get_Pointer ( "St1y" );
St1u= (DevStraw*) Apparato->Get_Pointer ( "St1u" );
St1v= (DevStraw*) Apparato->Get_Pointer ( "St1v" );
St2x= (DevStraw*) Apparato->Get_Pointer ( "St2x" );
St2y= (DevStraw*) Apparato->Get_Pointer ( "St2y" );
St2u= (DevStraw*) Apparato->Get_Pointer ( "St2u" );
St2v= (DevStraw*) Apparato->Get_Pointer ( "St2v" );
St3x= (DevStraw*) Apparato->Get_Pointer ( "St3x" );
St3y= (DevStraw*) Apparato->Get_Pointer ( "St3y" );
St3u= (DevStraw*) Apparato->Get_Pointer ( "St3u" );
St3v= (DevStraw*) Apparato->Get_Pointer ( "St3v" );
St4x= (DevStraw*) Apparato->Get_Pointer ( "St4x" );
St4y= (DevStraw*) Apparato->Get_Pointer ( "St4y" );
St4u= (DevStraw*) Apparato->Get_Pointer ( "St4u" );
St4v= (DevStraw*) Apparato->Get_Pointer ( "St4v" );
mnp1 = (DevMagn*) Apparato->Get_Pointer ( "Mnp1" );
mnp2 = (DevMagn*) Apparato->Get_Pointer ( "Mnp2" );
Mag48= (DevMagn*) Apparato->Get_Pointer ( "Magn" );
Mnp33= (DevMagn*) Apparato->Get_Pointer ( "Mnp33" );
hodo = (DevChod*) Apparato->Get_Pointer ( "Hodo" );
hodox = (DevChod*) Apparato->Get_Pointer ( "Hodx" );
hodoy = (DevChod*) Apparato->Get_Pointer ( "Hody" );
hadc = (DevHac*) Apparato->Get_Pointer ( "HACM" );
iron = Apparato->Get_Pointer ( "Ironwall" );
muvet1= (DevMuv*) Apparato->Get_Pointer ( "MUVET1" );
muvet2= (DevMuv*) Apparato->Get_Pointer ( "MUVET2" );
muvet3= (DevMuv*) Apparato->Get_Pointer ( "MUVET3" );
monit = Apparato->Get_Pointer ( "Moni" );
mamud= Apparato->Get_Pointer ( "Mamu" );
sacdev= (DevSac*)Apparato->Get_Pointer ( "Sac" );
ircdev=(DevIrc*)Apparato->Get_Pointer ( "IRC" );
lkry= (DevLkr*) Apparato->Get_Pointer ( "Lkry" );
if ( lkry==0 ) lkry= (DevLkr*)Apparato->Get_Pointer ( "Lkr" );
}
| void Device::GetWindowHits | ( | double | trigger_time | ) |
La procedura è attivata se la flag Pipeline is on, per recuperare l'evento successivo dal Buffer circolare G_Hits e copiarlo in M.Hits.
L'evento viene poi elaborato da procedure di analisi e sottoposto a programmi di plotting (root/paw).
Definition at line 607 of file device.cpp.
{
double dtm, adtm;
int pipe=0;
nhit=-1;
mhit=0;
if ( gnhit<0 ) return; // gnhit: total hit seen up to now memorized in the circular buffer
double tmorto=t_dead_mem; // get dead time of the device
if ( tmorto>0.0 ) tmorto=t_dead_mem +0.001;
else tmorto=0.001; //if zero set to 0.001 ns
int ghit=ghit_last; // get the last hit
ghit_last=0;
// Gout<<"\n In Dev " <<nome << " for trig_time " <<trigger_time;
// cout<<"\n In Dev " <<nome << " for trig_time " <<trigger_time;
int ih=0;
while ( ih<circular_buffer )
{
ghit=ghit%circular_buffer;
if ( G_Hits[ghit].tempo<-9. ) break; // test on last hit to break the loop...
dtm = trigger_time -G_Hits[ghit].tempo; // difference between trigger_time and hit_time...
adtm=fabs ( dtm );
if ( adtm<=tmorto ) //Test if the hit is inside the dead_time....
{
pipe=0;
nhit++;
if ( adtm>0.001 )
{
pipe=1;
evento_.Gen.Pipev=1;
}
M_Hits[nhit]=G_Hits[ghit]; //copy from circular buffer into M_Hits...
M_Hits[nhit].Pileup=pipe;
if ( ghit_last==0 ) ghit_last=ghit;
}
else if ( dtm>0.0 ) ghit_last=ghit;
else if ( dtm<0.0 ) break;
// Gout<<" Lasthit "<<setw(5)<<ghit_last<<" pipe "<<pipe ;
if ( nhit> ( working_buffer-2 ) )
{
Gout<<"\n Ev "<< evento_.Gen.Event<<" Too many hits in dev " << nome<< " see GetWindowHits()... exit" <<endl;
exit ( 0 );
}
ghit++;
ih++;
}
mhit=nhit+1;
// if(mhit>0)Gout<<"\n Ev "<< Eventi_Fatti<<" In dev "<<nome<<" Collected hits "<<mhit;
}
| void Device::Reset_Dev | ( | ) |
Reset del device: chiamata da Reset_Devices().
Definition at line 494 of file device.cpp.
{
// attenzione dove si mette questo reset... si suppone all'inizio evento
// quando si conosce il tempo di generazione del nouvo evento ....
nowpos=prevpos=6; //posizione non definita
accedi=0;
rivela=0;
eDev=0.0;
Brem_done=Pair_done=0;
nhit=-1;
mhit = 0;
if ( Pipeline==0 )
{
gnhit = -1; // hits generati
}
}
| void Device::Reset_Pos | ( | ) |
Reset della posizione della particella rispetto al device.
Definition at line 468 of file device.cpp.
{
// start from the tree top
Device *pdev=Apparato;
while ( pdev!=0 )
{
nowpos=prevpos=6;
pdev=pdev->next;
}
}
| void Device::ScrvColpi | ( | Particella * | pr | ) | [virtual] |
Memorizza gli hits delle particelle nel buffer del rivelatore interessato e cioè nel buffer di evento Hits.... Nel caso delle accidentali (flag Pipeline on) copia i dati nel buffer circolare G_Hits!
RIVELA:
Definition at line 521 of file device.cpp.
{
// cout<<"\n Ev Scrv "<<Eventi_Fatti<< " dev "<<nome<< " pr "<<pr->nome<<" colpo "<<colpo<<" visto "<<visto;
if ( nhit> ( working_buffer-2 ) ) //verifica la size del buffer!
{
Gout<<"\n Ev "<< Eventi_Fatti<<" In dev "<<nome<<" too many particles "<< nhit<< " get out! "<<endl;
Scrivi_Dati ( 2 );
flyoend();
exit ( 0 );
}
// aggiorna il contatore di dev per le particelle che lo attraversano
Part_hit[Idsee]++;
Tot_seen++;
pr->devhit=idev; //memorizzo l'ultimo indice del dev colpito.
// salva in formato codificato i devices colpiti dalla particell
// il bit acceso corrisponde al device colpito
// attenzione memorizza solo i primi 64 device.
pr->Update_Devstory ( idev );
if ( rivela>2 ) return; // non registered
// attenzione si evita anche di registrare gli hits per i dev che non sono esplicitamente
// usati nella analisi successiva. registra=(0,1)==(no,si)
if ( registra==0 ) return;
nhit++; // remember nhit starts from -1 that corrisponds to no hits...
Bufdev *bf = &Hits[nhit];
bf->Pr= pr;
bf->tempo= evento_.Gen.tempo;
bf->idead= pr->Ifato;
bf->devstory= pr->devstory;
bf->last_path= pr->last_path;
bf->pnome = pr->nome;
bf->id= pr->id;
bf->idm= pr->idm;
bf->Vers= pr->Vers;
bf->Xlab= pr->X;
bf->Xdev= Lab2cDev ( pr->X );
bf->Pdev= pr->P;
bf->structinfo= Get_Structinfo();
// ----------------------
if ( rivela>0 ) bf->e_rivela=pr->P.e;
else bf->e_rivela=0.0; //it is done anyway if multiplescattering if required...
// ------------- pipeline test -------
if ( Pipeline==0 ) return;
// pipeline is on! copies the hits in the circular buffer
gnhit++; // hits index up to now...
ghcir=gnhit%circular_buffer; //attention... Circular buffer
G_Hits[ghcir]=bf[0];
G_Hits[ ( ghcir+1 ) %circular_buffer].tempo=-10; //set to -10 next hit not yet arrived....
// Gout<<"\n Eve_gen "<<evento_.Gen.Event<<" dev "<<nome<< " hit "<<gnhit<<" "<<ghcir<<" tempo "<< G_Hits[ghcir].tempo
// <<" " << G_Hits[(ghcir+1)%circular_buffer].tempo;
;
};
| void Device::Set_Rivela | ( | Particella * | pr | ) |
RIVELA:
Definition at line 1067 of file device.cpp.
{
int isee;
const char *label;
if ( escludi!=1 )
{
// dev visibile
accedi=0;
rivela=-1;
// test if the dev sees the particle ...first by name
isee = nvede;
while ( isee >= 0 )
{
label = vede[isee];
if ( label == pr->nome )
{
rivela=assorb[isee];
Idsee=isee;
break;
}
isee--;
}
// ... and now by type
if ( rivela==-1 )
{
isee = nvede;
while ( isee >= 0 )
{
label = vede[isee];
if ( label == All ||label == pr->type ||
( label == Char && pr->charg!=0. ) )
{
rivela=assorb[isee];
Idsee=isee;
break;
}
isee--;
}
}
}
// if(idev>1&&idev<4)
// Gout<<"\n Riv "<< nome <<" "<<pr->nome<<" " <<accedi << " " <<rivela;
}
| int Device::Traccia | ( | Particella * | pr | ) | [virtual] |
================ T R A C C I A ====================================
Traccia le particelle nell'apparato per un tratto come definito in Get_camm(). Nel tracciare la particella si tiene conto della possibilita' della pair production e del bremsstrhalung.
Reimplemented in DevFlt, DevFluka, DevLkr, and DevMagn.
Definition at line 950 of file device.cpp.
{
int iter=0;
// impulso ==0 no tracing ... return;
if ( pr->P.norma == 0.0 ) return 1;
lint=nowpos?libuc:liint; //get the interaction length
if ( fun==Bersaglio&& pr->rg!=0&&lint>0.0&&nowpos<1 )
{ // se qui è un caso particolare... particelle si distrugge nel dev
// Il dev fa da bersaglio
// ed è interna o nel buco ( è qui c'è di default)
// e la lunghezza di interazione è definita non nulla!
// si ridefisce il cammino se interagisce nel bersaglio
pr->Get_Bersaglio ( this,lint );
if ( pr->Ifato==-3 )
{ // la particella è stata distrutta!!!
pr->Move ( pr->pathok ); // nuovo path (ma vedere meglio)
pr->last_path=pr->pathok;
pr->rg->dw->X=pr->rg->X=pr->X; // definisco la posizione del C.M.
pr->rg->dw->Gx=pr->rg->Gx=pr->X;
return -3; // la bullet muore nel dev
}
}
double tratok=pr->pathok;
lrad=nowpos?lradb:lradi; //get the radiation length
if ( lrad==0. ) // no radiation...
{
// free flight
pr->Move ( tratok );
pr->last_path=tratok;
return 0;
}
// qui lrad != 0
if ( pr->charg ==0.0 )
{
// se è un gamma fa Pair_Production
if ( pr->Pair_Production>0&& Pair_done<maxPair ) // Pair production activated?
{
if ( pr->P.e<0.002 ) // Energy cutoff .... fare meglio
{
Hits[nhit].e_rivela+=pr->P.e; // aggiorno l'energia persa...
Hits[nhit].idead=-18;
pr->Ifato=-18;
pr->P.setqn ( 0.,0.,0.,0. );
pr->pathok=0.0;
return -18;
}
pr->Get_Pair ( this,tratok,lrad );
Hits[nhit].idead=pr->Ifato;
pr->pathok=tratok; //redefine (if nedeed) free path before pair prod..
}
pr->Move ( tratok );
pr->last_path=tratok;
return 0;
}
// qui lrad != 0 ed è carica
int crepa;
double passdone=0.0;
double passo= lrad;
// fa bremsstrahlung
while ( passdone<tratok )
{
double diff=tratok-passdone;
if ( diff <passo ) passo =diff+0.001;
if ( pr->Brems_Production>0 && Brem_done<maxBrems )
{
if ( pr->Get_Brems ( this,passo,lrad ) !=0 )
{
pr->Move ( passo ); // divido per 2 ??? media
Mscatter ( pr,passo );
pr->last_path=passdone+passo;
Hits[nhit].idead=pr->Ifato;
return 0;
}
}
// qui se non c'è stato brems...
pr->Move ( passo ); //forse passo/2 ???!|!!
if ( ( crepa=Mscatter ( pr,passo ) ) !=0 )
{
pr->last_path=passdone+passo;
Hits[nhit].idead=crepa;
return crepa;
}
passdone+=passo;
iter++;
}
Hits[nhit].idead=pr->Ifato;
Hits[nhit].last_path =pr->last_path=tratok;
return 0;
}
M_Hits contiene gli hits dei dev copiati nella opportuna finestra di trigger. Questi dati si elaborano con le procedure DataSmear() e Simuladev() e quindi si trasferiscono sul file per analisi root Vedi outnt.cpp.
Type(2) variables: M_Hits Dev hit info at Measured level (with errors)
G_Hits è un buffer circolare,dimensionato max 100 per ogni device, in cui si memorizzano, se pileup è acceso, i dati che sono via, via generati ed hanno colpito il device. In pratica si copiano i dati da Hits in successione temporale. Se si verifica un trigger definito, per esempio in Trigger_Box, secondo un criterio di minima si accede a ciascun buffer circolare e si prelevano, per ogni dev, gli hits da G_Hits in una finestra temporale definita attorno al trigger_time e si memorizzano in M_Hits[30].
Type(1) variables: G_Hits Circular buffer for the hits if pipeline is on.