12 #include "RandomGenerator.hh"
37 for (
size_t i = 0; i < fDetData.size(); i++) {
39 delete fDetData[i]; fDetData[i] = 0x0;
50 fPM =
new prismaManager(pmanager); Random::randomize();
57 if( (conf_file = fopen(filename,
"r")) == 0x0) {
58 std::cout <<
" Error, cannot open " << filename <<
std::endl;
return false;
63 if(fscanf(conf_file,
"%d %d %d",&Conv,&Ch,&Cont) != 3) {
64 cout <<
"Error reading line " << ii <<
" of " << filename <<
endl;
70 std::cout <<
"LUT[ " << Conv <<
" ][ " << std::setw(2) << Ch <<
" ] = " << std::setw(3) << LUT[Conv][Ch] <<
std::endl;
73 std::cout <<
"Prisma LUT " << filename <<
" is correctl initialised " <<
std::endl;
return true;
81 if ( fCurrentSize == fDetData.size() ) {
82 data =
new detData (ndet,npar);
83 fDetData.push_back( data );
85 else { data = fDetData[fCurrentSize++]; data->reset_detData(ndet,npar); }
106 ::memset(theMap, 0,
sizeof(theMap));
111 if ( LUT[ii][jj] < 0)
113 theMap[ LUT[ii][jj] ] =
rawBuf[ii*gMaxChannels+jj];
123 for (
int ii=0; ii<6; ii++) {
124 if ( theMap[60*zz+6*jj+ii] > 250.f ){
133 if( nParam[zz][jj] > 0 )
145 if( nParam[0][jj] < 1 )
148 for(
int ii=0; ii<pA; ii++ )
149 if (theMap[6*jj+ii] > 0)
150 aData->set( ii, theMap[6*jj+ii] + Random::uniform() - 0.5 );
160 if( nParam[1][jj] < 1 )
163 for(
int ii=0; ii<pR; ii++ )
164 if ( theMap[60 + 6*jj+ii] > 0 )
165 aData->set( ii, theMap[60 + 6*jj+ii] + Random::uniform() - 0.5 );
182 if( nParam[2][jj] < 1 )
185 for(
int ii=0; ii<pI; ii++ )
186 if (theMap[120 + 6*jj+ii]>0)
187 aData->set( ii, theMap[120 + 6*jj+ii] + Random::uniform() - 0.5 );
197 if( nParam[3][jj] < 1 )
200 for(
int ii=0; ii<pS; ii++ )
201 if (theMap[180 + 6*jj+ii]>0)
202 aData->set( ii, theMap[180 + 6*jj+ii] + Random::uniform() - 0.5 );
209 cout <<
" Testing new event " <<
endl;
210 for(
int ii=0; ii<(int)
theMcpData.size(); ii++ ) {
212 cout << endl <<
"New MCP " << (*aData) <<
endl;
216 cout << endl <<
"New PPAC " << (*aData) <<
endl;
219 for(
int ii=0; ii<(int)
theIcData.size(); ii++ ) {
221 cout << endl <<
"New IC " << (*aData) <<
endl;
226 cout << endl <<
"New Side " << (*aData) <<
endl;
238 fFP( new TObjArray(gMaxSections) ),
239 fLR( new TObjArray(gMaxSections) )
242 fFP->SetOwner(
false);
243 fLR->SetOwner(
false);
247 h =
new TH2F(Form(
"TOF_Xfp%d",i),Form(
"TOF_Xfp%d",i), 512, 0, 4096, 512, 0, 4096);
250 h =
new TH2F(Form(
"fLR%d",i),Form(
"fLR%d",i), 512, 0, 4096, 512, 0, 4096);
310 IcABvsABCD =
new TH2F(
"Ic_ABvsABCD",
"E_DeltaE_AB", 1024,0,12000,2048,0,8000);
312 IcAvsABCD =
new TH2F(
"Ic_AvsABCD",
"E_DeltaE_A", 1024,0,12000,2048,0,8000);
314 TOF_D =
new TH2F(
"ToF(ns)vsX_FP(mm)",
"ToFvsx_FP", 1024,0,1024,4096,0,4096);
316 PRISMA_MCPcal =
new TH2F(
"MCPcal",
"MCP calibrated", 1024,-50,50, 1024,-50,50);
318 PRISMA_X_FP =
new TH1I(
"PRISMA_Xfc",
"X focal plane in PRISMA",4096,0,4096);
320 PRISMA_Vel =
new TH1I(
"PRISMA_Vel",
"Velocity in PRISMA",8000,0,0.25);
322 Range_Energy =
new TH2F(
"Range_Energy",
"Range_Energy", 1024,0,4096, 1024,0,20000);
324 Vel_Theta =
new TH2F(
"Vel_Theta",
"Vel_Theta", 1023,1,1024, 1024,0,0.2);
326 a_over_q =
new TH2F(
"a_over_q",
"a_over_q", 1024,0,1200, 4096,0,450);
328 Energy_RBeta =
new TH2F(
"Energy_RBeta",
"Energy_RBeta", 1024,0,4096, 1024,0,20000);
330 PRISMA_Mass =
new TH1F(
"PRISMA_Mas",
"PRISMA_Mas", 4096,0,4096);
338 c->Divide(5,2,0.0001,0.0001);
340 IcABvsABCD->Draw(
"col");
342 IcAvsABCD->Draw(
"col");
346 PRISMA_MCPcal->Draw(
"col");
350 Range_Energy->Draw(
"col");
352 PRISMA_Vel->Draw(
"");
354 a_over_q->Draw(
"col");
356 Energy_RBeta->Draw(
"col");
386 const double c_light = 29.97295 * cm/ns;
394 if (
fPM->length() > 0. ) {
396 Vector3D Vel =
fPM->velocity()/c_light;
399 IcABvsABCD -> Fill(
fPM->ic_energy(),
fPM->ic_energy_AB_DE());
401 TOF_D -> Fill(
fPM->x_fp() /mm, 10*
fPM->tof()/ns);
402 PRISMA_MCPcal -> Fill(
fPM->mcp_x()/mm ,
fPM->mcp_y()/mm) ;
403 PRISMA_X_FP -> Fill(
fPM->x_fp() /mm) ;
404 PRISMA_Vel -> Fill( Vel.rho() ) ;
405 Range_Energy->Fill(
fPM->range(),
fPM->ic_energy()) ;
406 Vel_Theta->Fill(10.*
fPM->theta_c()/degree, Vel.rho() );
407 a_over_q->Fill(
fPM->x_fp()/mm,
fPM->a_over_q_uncal());
408 Energy_RBeta->Fill(
fPM->r_beta(),
fPM->ic_energy());
409 PRISMA_Mass->Fill(
fPM->Mass());
421 fTypeName = AgataEventDisplay::Instance()->RegisterBranch(
"Prisma");
422 AgataEventDisplay::Instance()->SetTrackStyle(
"Rectangle", fTypeName);
427 TTask::SetActive(active);
428 AgataEventDisplay::Instance()->Reset();
441 const double c_light = 29.97295 * cm/ns;
450 Vector3D Vel =
fPM->velocity()/c_light;
451 Vector3D posQpoleIn =
fPM->getPosQuadrupoleIn();
452 Vector3D posQpoleOut =
fPM->getPosQuadrupoleOut();
453 Vector3D posDipIn =
fPM->getPosDipoleIn();
454 Vector3D posDipOut =
fPM->getPosDipoleOut();
455 Vector3D posFP =
fPM->getPosFocalPlane();
456 Vector3D center =
fPM->getCenter();
457 Float_t radius =
fPM->radius();
459 if (
fPM->length() > 0. ) {
470 thit->
SetE(
fPM->energy_over_beta()+100);
474 thit->
SetX(-posQpoleIn.X()/cm);
475 thit->
SetY( posQpoleIn.Z()/cm);
476 thit->
SetZ( posQpoleIn.Y()/cm);
477 thit->
SetE(
fPM->energy_over_beta()+100);
480 thit->
SetX(-posQpoleOut.X()/cm);
481 thit->
SetY( posQpoleOut.Z()/cm);
482 thit->
SetZ( posQpoleOut.Y()/cm);
483 thit->
SetE(
fPM->energy_over_beta()+100);
487 thit->
SetX(-posDipIn.X()/cm);
488 thit->
SetY( posDipIn.Z()/cm);
489 thit->
SetZ( posDipIn.Y()/cm);
490 thit->
SetE(
fPM->energy_over_beta()+100);
493 Float_t phi1 = TMath::Abs(TMath::ATan((posDipIn.X()-center.X())/(posDipIn.Y()-center.Y())));
494 Float_t phi2 = TMath::Abs(TMath::ATan((posDipOut.X()-center.X())/(posDipOut.Y()-center.Y())));
495 Float_t dphi = TMath::Abs(phi2-phi1)/10.;
497 for (Int_t i = 1; i < 10; ++i) {
499 thit->
SetX(-(center.X()/cm - radius*TMath::Sin(phi1 -
float(i)*dphi)/cm));
500 thit->
SetY( posDipIn.Z()/cm);
501 thit->
SetZ( center.Y()/cm + radius*TMath::Cos(phi1 -
float(i)*dphi)/cm);
502 thit->
SetE(
fPM->energy_over_beta()+100);
507 thit->
SetX(-posDipOut.X()/cm);
508 thit->
SetY( posDipIn.Z()/cm);
509 thit->
SetZ( posDipOut.Y()/cm);
510 thit->
SetE(
fPM->energy_over_beta()+100);
514 thit->
SetX(-posFP.X()/cm);
515 thit->
SetY( posFP.Z()/cm);
516 thit->
SetZ( posFP.Y()/cm);
517 thit->
SetE(
fPM->energy_over_beta()+100);
520 if (
fPM->path() > 0) {
521 Float_t phi = TMath::ATan(-(posFP.X()-posDipOut.X())/(posFP.Y()-posDipOut.Y()));
522 Float_t x = -posFP.X()/cm +
fPM->path()*TMath::Sin(phi)/10;
523 Float_t z = posFP.Y()/cm +
fPM->path()*TMath::Cos(phi)/10;
528 thit->
SetE(
fPM->energy_over_beta()+100);
536 TTask::SetActive(
false);
554 const double c_light = 29.97295 * cm/ns;
565 if (
fPM->length() > 0. &&
fPM->tof()/ns > 100 &&
fPM->tof()/ns < 300 )
567 Vel =
fPM->velocity()/c_light;
569 Vel = Vector3D(0,0,0);
588 GetTree()->Branch(
"AoverQ", &fAoverQ,
"AoverQ/F");
589 GetTree()->Branch(
"Radius", &fRadius,
"Radius/F");
590 GetTree()->Branch(
"Ic_AB_DE", &fIc_AB_DE,
"AoverQ/F");
591 GetTree()->Branch(
"Ic", &fIc,
"Ic/F");
592 GetTree()->Branch(
"x_fp", &fx_fp,
"x_fp/F");
593 GetTree()->Branch(
"TOF", &fTOF,
"TOF/F");
594 GetTree()->Branch(
"Range", &fRange,
"Range/F");
595 GetTree()->Branch(
"Ic_A_DE",&fIc_A_DE,
"Ic_A_DE");
605 printf(
"MyPrismaTree::Exec is called \n");
613 fAoverQ =
fPM->a_over_q_uncal();
614 fRadius =
fPM->path();
615 fIc_AB_DE =
fPM->ic_energy_AB_DE();
616 fIc =
fPM->ic_energy();
617 fx_fp =
fPM->x_fp() /mm;
618 fTOF =
fPM->tof()/ns;
619 fRange =
fPM->range();
620 fIc_A_DE =
fPM->ic_energy_A_DE();
AgataEventContainer class that contains agata event to be displayed.
virtual VertexInterface * GetVertex()
Get the vertex data interface.
std::vector< detData * > theSideData
printf("******************************************************************** \n")
DisplayPrisma(const char *name, const char *title)
virtual void Exec(Option_t *option="")
watch the current frame
Interface for any watcher that is a VertexBuilder.
StdHit * NewHit()
Add a new hit to the track (filling mode). The Stack is emptied by calling Reset. ...
DoPrismaDoppler(const char *name, const char *title)
AgataEventDisplay a class to work on a specific event display.
virtual void ShowEve(const Char_t *prismaConfFile, const Char_t *agataPathFile)
show eve event display
virtual void SetActive(Bool_t active=true)
Toggle active task.
virtual void SetZ(Float_t z)
Bool_t InitLUT(const char *)
to init the LUT from a file
BasePrismaWatcher(const char *name, const char *title)
detData * GetNextDetData(Int_t, Int_t)
Next detData in the pool.
virtual void SetPosition(Double_t, Double_t, Double_t, Double_t=0.0)=0
Set the position of the source (last argument is used in case the position depends on time) ...
ClassImp(BasePrismaWatcher)
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
Apply the doppler correction.
TObject * AddToPool(TObject *ob)
facility for other watchers: keep a list of all histograms (objects) for global operations ...
void FillTracks(Option_t *type="Agata")
static const Int_t gmaxTypes
Base for a watcher on an ancillary (raw) frame.
virtual ~BasePrismaWatcher()
Bool_t fIsToBeDeleted
True if the vertex frame is to be deleted by this. Otherwise it is extracted from a trigger i...
AgataEventContainer * GetEventContainer() const
virtual void SetY(Float_t y)
Base for a watcher on Prisma (raw) frame.
void BuildDefaultGeometry(Bool_t danteGeo=true, Bool_t prismaGeo=true, Bool_t agataGeo=true, Bool_t passiveGeo=true)
void ResetDetDataStack()
Reset stack.
virtual void SetE(Float_t e)
void SetLastExecStatus(Short_t s=0)
reset last status. 0 means no error, 0 < means error, > 0 means ok with conditions ...
Base class for a Watcher that fill a TTree or some branches of a TTree.
virtual void Exec(Option_t *option="")
watch the current frame
Base class for version numbers.
static const UShort_t gMaxChannels
virtual void SetX(Float_t x)
Setter position & energy.
static const Int_t gMaxSections
TrackHit * NewTrackHit(Option_t *type="Agata")
add current track hit (added to current track hit list)
virtual void Exec(Option_t *option="")
watch the current frame
EvePrisma(const char *name, const char *title)
virtual void FillTree()
Fill the tree if it is the owner of the tree.
Float_t rawBuf[gMaxSlots *gMaxChannels+gExtraSize]
static const UShort_t gMaxSlotsForPrisma
virtual void Exec(Option_t *option="")
watch the current frame
ADF::LogMessage & endl(ADF::LogMessage &log)
static void SetDefaultAgataPath(const Char_t *name)
virtual void SetDirection(Double_t, Double_t, Double_t, Double_t=0.0)=0
set the direction of the source (last argument is used in case the position depends on time) ...
std::vector< detData * > thePpacData
Short_t GetLastExecStatus() const
to get the last status
SharedFP * fVertexFrame
Pointer to a Vertex Frame. Has to do SharedFP since can be in the data flow.
virtual void Exec(Option_t *option="")
watch the current frame
RawPrisma(const char *name, const char *title)
virtual void SetBeta(Double_t, Double_t=0.0)=0
set recoil velocity
virtual void SetBranches()
virtual void Exec(Option_t *option="")
watch the current frame
void Configure(const char *pmanager="Conf/", const char *plut="Conf/")
std::vector< detData * > theIcData
std::vector< detData * > theMcpData
MyPrismaTree(const char *name, const char *title, TTree *tree=0x0)
virtual void Exec(Option_t *option="")
watch the current frame
Int_t GetNofEvents() const
get Number of events
Base class that described an item in a Factory.
static AgataEventDisplay * Instance()
static void SetDefaultPrismaConf(const Char_t *name)
TTree * GetTree()
to get the current Tree