FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_dev/device.h

00001 /***************************************************************************
00002                           device.h  -  description
00003                              -------------------
00004     begin                : Sat May 26 2001
00005     copyright            : (C) 2001 by Giuseppe Pierazzini
00006     email                : peppe@unipi.it
00007  ***************************************************************************/
00008 
00009 #ifndef DEVICE_H
00010 #define DEVICE_H
00011 #include "gvet.h"
00012 #include "gvet.h"
00013 
00014 
00015 
00016 #if defined(MAINFLYO)
00017 // Flags to define the device fuction....
00018 const char *Veto = "veto", *Trig = "trig", *Trigh = "hard_t";  // Fun
00019 const char *None = "none", *Dead = "dead", *Dump = "dump";  // Fun
00020 const char *Magn = "magn" ,*Nodef ="nodef",*Bersaglio="bersag"; // Fun
00021 const char *Detect = "det";
00022 #endif
00023 #if !defined(MAINFLYO)
00024 extern const char *Veto, *Trig, *Trigh, *Magn;  // Fun
00025 extern const char *None,*Dead, *Dump, *Nodef,*Bersaglio; // Fun
00026 extern const char *Detect;
00027 #endif
00028 
00029 
00030 
00031 
00032 
00033 //class Particella;
00034 #include "particella.h"
00035 
00036 void Set_Rivela_in_Dev ( Particella * );
00037 void Reset_Devices();
00038 
00039 
00040 // struttura per la memorizzazione dei dati....
00047 struct Bufdev
00048 {
00049     Particella *Pr;
00050     int  id;            // Indice della particella all'interno della reazione
00051     int  idm;           // Indice di materia, ovvero  tipo di particella rivelata
00052     int  idead;         // Tipo di morte, fato
00053     int  structinfo;    // Posizione della particela rivelata
00054     unsigned long long devstory; //storia dei dev attraversati... vedi meglio
00055     int Pileup;         // indice di pileup
00056     const char *pnome;        // nome della particella
00057     double last_path;   // cammino fatto nel dev
00058     double tempo;       // tempo di generazione  in ns.
00059     double e_rivela;    // energia della particella rivelata dal dev
00060     gvet Xlab,Xdev;     // cordinate nel lab e dev al punto di impatto
00061 // attenzione vers e Pdev non hanno errori! controllare.
00062     gvet Vers;          // direzione (comegenerata) di volo della particelle nel punto di impatto
00063     qvet Pdev;          // quadrivettore impulso energia...
00064    
00065     
00066 };
00067 
00092 // =================   D E V I C E  ==== base class =======
00093 // =================   D E V I C E  ==== base class =======
00094 // =================   D E V I C E  ==== base class =======
00095 
00096 class Device
00097 {
00098     friend class Particella;
00099     friend class TriggerBox;
00100     friend class  Radiografia;
00101 
00102 protected:
00103     int devtype;
00104     std::string devclass;
00105     int idev;    // dev id  =  numero d'ordine  di creazione        
00106          char nome[9];//  nome : identifica anche il blocco hbook nella ntupla
00107          char nickname[9]; //  nickname: defined for root device name. Usually shorter..but non important..
00108          
00109     const char *fun;           // device funzione
00110     int  nvede,assorb[30];       // -1,0,1,2,3 detection levels
00111     const char *vede[30];              // lista particelle visibili
00112     int registra;    //variabile globale di registrazione hits. default =1 (si) 
00113   
00114   
00115     gvet Centro,Centrin,Cface;        // centro dev e centro del buco rispetto al c_dev
00116     gvet Nx, Ny,Nz;
00117 
00118 // versori di orientamento
00119 // Questi corrispondono ( a meno del segno) ai versori dei
00120 // piani che definiscono il volume del dev.
00121 // I versori dei piani vanno pensati orientati verso l'esterno.
00122 // per un dev parallelepipedo di dimensioni: a,b,c
00123 
00124 // piani           1    2    3    4    5    6
00125 // perpendic. a    x    x    y    y    z    z
00126 // in             -a    a   -b    b   -c    c
00127 // versore       -Nx   Nx  -Ny   Ny  -Nz   Nz
00128 //------------------------------------------------------
00129 
00130     gvet Lout,Lin,Fortax;   // vettori semidimensioni device
00131     gvet X_dev,V_dev;
00132     double OpenSector,Rqsize;
00133 
00134 // Lout definisce le dimensioni esterne del dev riferite al centro device
00135 // Lin quelle interne del buco
00136 // Lout e Lin  per geom rett. sono definiti come (lx/2,ly/2,lz/2)
00137 // corrispondenti alle coordinate dello spigolo in alto.
00138 // per geom cilindriche con asse z lungo l'asse del cilindro
00139 // come: (R,0.,lz/2)
00140 // corrispondenti alla cordinata posta in alto del cilindro
00141 // sullo  spigolo positivo.
00142 
00143 // ---------------- Materiali di costruzione  ---------------------
00144 // il dev e' costruito con un materiale indicato come materiale interno "mattin"
00145 // il buco contine un'altro materiale di solito gas.. definito in "mattbuc"
00146 // si indicano  la Z dei materiali "Zint,Zbuc"
00147 // il numero atomico "Aint,Abuc"
00148 // lunghezza di interazione interno e nel buco "liint,lbuc",
00149 // la densita' "Roint,Robuc"
00150 // la perdita di energia al minimo "Dedxint,Dedxbuc"
00151 // lunghezze di radiazione: lradi,lradb
00152 // variabili di comodo: lrad,Ro,Dedx.
00153 //
00154  //   char mattint[10] ,mattbuc[10];
00155     std::string mattint,mattbuc;
00156     int Zint,Zbuc;
00157     double Aint,Abuc,liint,libuc;
00158     double Roint,Robuc,Dedxint,Dedxbuc;
00159     double lradi,lradb;
00160     double lrad,nrad,Ro,Dedx,lint;
00161 // tutti dati sono definiti sia nelle schede di descrizione dei dev
00162 // o meglio derivati dal data_base dei materiali definiti prima
00163 // dei device nei file di descrizione .epc o  app.
00164 //------------------------------------------------------------------------------
00165     double reckik;
00166     gvet Field;
00167     int campo;
00168     double Bref,Dbref;    //Beref Campo alla distanza dal centro Dbref
00169     gvet Field_sav;
00170     double time_now;
00171     double t_dead_mem;       // tempo morto del device 
00172     
00173 //------------------------------------------
00174 
00175 //-------------D U M M I E S -----------------
00176 //dummy variable to evaluate the multiple scattering...
00177 //   gvet DX,Rx,Ry,Rz,S,Dplane;
00178 
00179 //dummy variables
00180     double cost, sint, sinf, cosf, txplane,typlane;
00181     double tet0,xplane,yplane,z1,z2;
00182 //    double  px,py,pz,p,   pt,     tratok;
00183     double Last_distq;
00184     double  dcs, path,tratto,camm;
00185     int posok,pos;
00186 //-----------------------------------------
00187 public:
00188 
00189     int   maxBrems,maxPair;
00190     int   Brem_done,Pair_done;
00191     int gnhit,ghcir,ghit_last;                  // numero di hits generati nel dev.
00192     int nhit,mhit;             // numero di hits nel dev.
00193     int Start_Hit;            // posizione  del primo hit nel buffer circolare
00194     double eDev;
00195 
00196     /* *******************************************************************
00197               W O R K I N G  buffers
00198 
00199 
00200     ********************************************************************/
00206     Bufdev *Hits;
00207     
00214     int working_buffer, circular_buffer;
00215     Bufdev *G_Hits;
00216     
00224     Bufdev *M_Hits;
00225 
00226 
00227 
00228 //*******************************************************************
00229 
00230 //*******************************************************************
00231     /* R O O T    tipical default buffer
00232      Attenzione: le dimensioni possono dipendere dal dev
00233      Vedi "void  Device::Make_measur_buffer ( int dim )"
00234     */
00235 
00236 //    int measur_buffer_dim == working_buffer;
00237     int hit_recorded;
00238 //    int *index, *mid,*mdead;
00239     int *index, *mid,*structinfo,*mdead;
00240     unsigned long long *devstory;
00241     float emDev;
00242     float *mxd, *myd, *mzd,*mdd, *me, *mxl, *myl, *mzl, *gpx, *gpy, *gpz, *ge;
00243     double *dtemp;
00244 
00245 
00246 //*******************************************************************
00247 
00248 
00249     Particella *pr_dev;   // particella attualmente nel dev
00250     int nowpos,prevpos,accedi,escludi,rivela,Idsee;
00251     int wrout;                   // se diverso da zero scrivo su out tape
00252     int Tot_seen, Part_hit[40];
00253     Device *up, *next;
00254     Device ();
00255     virtual ~Device();
00256     void Leggi_schede_dev();
00257     char *  Get_Nome() {
00258         return nome;
00259     };
00260     char *  Get_NickName() {
00261         return nickname;
00262     };
00263     int     Get_Idev() {
00264         return idev;
00265     }
00266     const char *  Get_Vede ( int i ) {
00267         return vede[i];
00268     };
00269     void  Make_working_buffer ( int );
00270     void  Make_measur_buffer ( int );
00271     
00272     
00273     int     Fill_Default();
00274     virtual void Reset_RootData(){};    
00275     int     Get_DatiOut();
00276     double  Get_Zsize() {
00277         return Lout.z;
00278     };
00279     void    Change_sign_Field() {
00280         Field=-Field;
00281     };
00282     void    Set_Field ( double B ) {
00283         Field[1]=B;
00284     };
00285     void  Set_Rivela ( Particella * );
00286     void  Reset_Dev ();
00287     void  Reset_Pos ();
00288     void  Dev_summary();
00289     void  SpiaPr ( char *,int,int,double );
00290     void Set_X_dev ( gvet gv ) {
00291         X_dev= gv;
00292     }
00293     gvet& Get_X_dev() {
00294         return X_dev;
00295     };
00296     gvet& Get_Centro() {
00297         return Centro;
00298     };
00299     gvet& Get_Cface() {
00300         return Cface;
00301     };    
00302     
00303     
00304     gvet& Get_Lout ( ) {
00305         return Lout;
00306     };
00307     gvet& Get_Lin ( ) {
00308         return Lin;
00309     }; 
00310  
00311     double Get_Kik() {
00312         return reckik;
00313     };
00314     void   Get_Materiali();
00315     void GetWindowHits ( double );
00316     virtual int SimulaDev() {
00317         return 0;
00318     };
00319     virtual gvet& Lab2Dev ( gvet& );
00320     virtual gvet& Lab2cDev ( gvet& );
00321     virtual gvet& Dev2Lab ( gvet& );
00322     virtual gvet& Devc2Lab ( gvet& );
00323     virtual int Posizione() {
00324         return 0;
00325     };
00326     virtual double CamEster() {
00327         return 0.0;
00328     };
00329     virtual double CamInter() {
00330         return 0.0;
00331     };
00332     virtual double CamBuco() {
00333         return 0.0;
00334     };
00335     virtual void  ScrvColpi ( Particella * );
00336     virtual int Traccia ( Particella * );
00337     virtual gvet& Get_Field ( gvet& x ) {
00338         return Field;
00339     };
00340     virtual gvet& Get_Field() {
00341         return Field;
00342     };
00343     virtual int Mscatter ( Particella *, double ) ;
00344     virtual void DataSmear() {/*attenzione.. si chiama dopo Simuladev*/};
00345     virtual double Msperdita ( double );
00346     virtual double Get_Res() {return 0.;};
00347     virtual int Get_Structinfo(){return nowpos;};
00348     void  PrgeomId();
00349     virtual void  Prgeom();
00350     void     Get_Pointers();
00351     Device * Get_Pointer ( const char * );
00352     
00353    
00354     
00355     
00356     Device * Get_camm ( Particella * );
00357 
00358 };
00359 #if defined(MAIN)
00360 int MemoryBuffer=40;
00361 
00362 Device *collo=0,*xch02=0,*spione0=0,*spione1,*vtappo=0;
00363 
00364 Device *Apparato=0,*Devloop=0,*dectubo=0;
00365 Device *mgb1=0,*mgb2=0,*mgb3=0,*mgb4=0,*mgb5=0;
00366 Device *iron=0,*monit=0;
00367 Device *fluka=0;
00368 Device *mamud=0;
00369 /**********************
00370     Scelta della classe che descrive il rivelatore
00371 
00372 Control word in epc   shape              class     device Type
00373 (first 5 characters)
00374   no             no                      Device          0
00375 rettangolo     parallelepipedo           DevRt           1
00376 rettrett       parall. con buco rett.    DevRtRt         2
00377 cilindro       cilindro                  DevCln          3
00378 rettcili       parall. con buco cili.    DevRtCl         4
00379 cilirett       cilin. con buco rett.     DevClRt         5
00380 corona         corona cilindrica         DevCrn          6
00381 ottagono       ottagonale                DevOt           7
00382 ottagono       ott.con buco ottag.       DevOtOt         8
00383 ottagono       ott. con buco cil.        DevOtCl         9
00384 ciliott        cilind. con buco ott.     DevClOt        10
00385 Lveto
00386 magnete        magnete                   DevMagn         20
00387 quadrupolo     quadrupolo magnetico      DevQuad         21
00388 magnete        Mag.con buco per filtro   DevFlt          22
00389 Gas            Dec.Reg. shape-beam-gas   DevGas          23
00390 
00391 chamber        Mwire Chamber             DevMwc          50
00392 lkr48          calorimetro(Na48)         DevLkr        51
00393 chod        hodoscopio (NA62)         DevChod        52
00394 hac48          Adron.calor(NA48)         DevHac          53
00395 ytax           acromat collimator        DevYTax         54
00396 xtax           acromat collimator        DevXTax         55
00397 bluetube       Blu tube                  DevBlue         57
00398 
00399 software       no shape                  DevTrk          100
00400 basedev        Rivelatore di base        DevBase         500
00401 **********************/
00402 int  TypDevCedar= 61   ;
00403 int  TypDevice  =  0   ;
00404 int  TypDevRt   =  1   ;
00405 int  TypDevRtRt =  2   ;
00406 int  TypDevCln  =  3   ;
00407 int  TypDevRtCl =  4   ;
00408 int  TypDevClRt =  5   ;
00409 int  TypDevCrn  =  6   ;
00410 int  TypDevOt   =  7   ;
00411 int  TypDevOtOt =  8   ;
00412 int  TypDevOtCl =  9   ;
00413 int  TypDevClOt =  10  ;
00414 int  TypDevMagn =  20  ;
00415 int  TypDevQuad =  21  ; 
00416 int  TypDevFlt  =  22  ;
00417 int  TypDevGas  =  23  ;
00418 int  TypDevLav=  24  ;
00419 int  TypDevSveto=  25  ;
00420 int  TypDevRich =  26  ;
00421 int  TypDevSector= 31  ;
00422 int  TypDevKbs  =  48  ;
00423 int  TypDevMwc  =  50  ;
00424 int  TypDevLkr  =  51  ;
00425 int  TypDevChod =  52  ;
00426 int  TypDevHac  =  53  ;
00427 int  TypDevYTax =  54  ;
00428 int  TypDevXTax =  55  ;
00429 int  TypDevMuv =  56  ;
00430 int  TypDevBlue =  57  ;
00431 int  TypDevGig  =  58  ;
00432 int  TypDevChanti=  60  ;
00433 int  TypDevStraw=  59  ;
00434 int  TypDevIrc=  62  ;
00435 int  TypDevSac  =  61 ;
00436 int  TypDevTrk  =  100 ;
00437 int  TypDevSfera =  500 ;
00438 
00439 #else
00440 
00441 extern int MemoryBuffer;
00442 
00443 extern Device *collo,*xch02,*spione0,*spione1,*vtappo;
00444 extern Device *Apparato,*Devloop,*dectubo;
00445 extern Device *mgb1,*mgb2,*mgb3,*mgb4,*mgb5;
00446 extern Device *iron,*monit;
00447 
00448 extern Device *fluka;
00449 
00450 //extern Device *Rich;
00451 
00452 
00453 
00454 extern Device *mamud;
00455 
00456 extern int  TypDevCedar  ;
00457 extern int  TypDevice  ;
00458 extern int  TypDevice  ;
00459 extern int  TypDevRt   ;
00460 extern int  TypDevRtRt ;
00461 extern int  TypDevCln  ;
00462 extern int  TypDevRtCl ;
00463 extern int  TypDevClRt ;
00464 extern int  TypDevCrn  ;
00465 extern int  TypDevOt   ;
00466 extern int  TypDevOtOt ;
00467 extern int  TypDevOtCl ;
00468 extern int  TypDevClOt ;
00469 extern int  TypDevMagn ;
00470 extern int  TypDevQuad ;
00471 extern int  TypDevFlt  ;
00472 extern int  TypDevGas  ;
00473 extern int  TypDevLav;
00474 extern int  TypDevSveto;
00475 extern int  TypDevRich;
00476 extern int  TypDevSector ;
00477 extern int  TypDevKbs  ;
00478 extern int  TypDevMwc  ;
00479 extern int  TypDevLkr;
00480 extern int  TypDevChod ;
00481 extern int  TypDevHac  ;
00482 extern int  TypDevYTax ;
00483 extern int  TypDevXTax ;
00484 extern int  TypDevMuv ;
00485 extern int  TypDevBlue ;
00486 extern int  TypDevGig  ;
00487 extern int  TypDevChanti;
00488 extern int  TypDevStraw;
00489 extern int  TypDevIrc;
00490 extern int  TypDevSac;
00491 extern int  TypDevTrk  ;
00492 extern int  TypDevSfera ;
00493 #endif
00494 #endif
00495 
00496 
00497 
00498 
00499 
00500 
00501 
00502 
00503 
00504 
 All Classes Namespaces Files Functions Variables