#ifndef Selector_h #define Selector_h #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Lib.C" #include "TProofServ.h" class TH1F; class TH2F; class TLegend; class MCP; class Tmap; class Vector; class Tmap; class Selector : public TSelector { public : TTree *t; TH2F* Intersection_plot_T0A; TH2F* Intersection_plot_T0C; TH2F* v2_LYZ; Header* h; TClonesArray* p; TParticlePDG* pdg; TDatabasePDG* pdgDb; int Output = 0; // 1 for if the output (8*8) or 0 for intersection i all points on MCP std::vector MCP_array_T0C; //! std::vector MCP_array_T0A; //! std::vector pore_positions; // This vector contains all pores position for both T0A and T0C ///---For Eventplane functions------------ std::vector particles_intersection_mcp; // v2_{EP} std::map< double,vector > Parameter_E; // LYZ Tmap* LYZ_Q; Tmap* LYZ_M; ///------------------------------------------- Selector(void) :t(0), Intersection_plot_T0A(0), Intersection_plot_T0C(0), v2_LYZ(0), LYZ_Q(0), LYZ_M(0), h(0), p(0), pdg(0), pdgDb(0) { } virtual~Selector(void){} virtual void Init(TTree* tree); virtual void Begin(TTree *tree); virtual void SlaveBegin(TTree*); virtual bool Process(Long64_t entry); virtual void SlaveTerminate(); virtual void Terminate(void); virtual TList *GetOutputList() const { return fOutput; } virtual void SetOption(const char *option) { fOption = option; } virtual void SetObject(TObject *obj) { fObject = obj; } virtual void SetInputList(TList *input) { fInput = input; } virtual int Version() const { return 2; } virtual Bool_t SetTree(TTree* tree); ClassDef(Selector,1); }; ///_____________________________________________________________________________ ClassImp(Selector) Bool_t Selector::SetTree(TTree* tree) { if (!tree) return false; t =tree; h = new Header; p = new TClonesArray("TParticle"); p->SetOwner(true); t->SetBranchAddress("header", &(h->run)); t->SetBranchAddress("particles", &p); pdgDb = TDatabasePDG::Instance(); return true; } ///_____________________________________________________________________________ void Selector::Init(TTree *tree){ Printf("Init got tree %p", tree); SetTree(tree); } ///_____________________________________________________________________________ void Selector::Begin(TTree *tree){ Printf("Begin got tree %p", tree); //SetTree(tree); } ///_____________________________________________________________________________ void Selector::SlaveBegin(TTree* tree){ SetTree(tree); //All the pointers Intersection_plot_T0A = new TH2F("MCP Intersection T0A", "MCP Intersection T0A", 5000, -0.20, 0.20, 5000, -0.20, 0.20); fOutput->Add(Intersection_plot_T0A); Intersection_plot_T0C = new TH2F("MCP Intersection T0C", "MCP Intersection T0C", 5000, -0.20, 0.20, 5000, -0.20, 0.20); fOutput->Add(Intersection_plot_T0C); v2_LYZ = new TH2F("v2_LYZ", "v_{2} Distribution", 100, 0, 150, 100, 0, 0.5); fOutput->Add(v2_LYZ); LYZ_Q = new Tmap; LYZ_M = new Tmap; fOutput->Add(LYZ_Q); fOutput->Add(LYZ_M); // Basic decleration of the MCP: Vector Quartz_Dimension(0.053,0.053,0.020); Vector Mcp_dimension(0.053,0.053,0.030); double space_between_the_sub_quartz = 1.0/1000.0; double heigth = Quartz_Dimension.GetY(); double ElectronicThickness = 0.05; double Reflective_index = 1.5; int number_of_Mcp = 20; int number_of_sub_quartz = 1; // This number should be minimum 1!!! double distance_between_quartz = 6.0/1000; char nameC[] = "T0C"; char nameA[] = "T0A"; int hist_ON_OFF = 0; //------------------------------------------------------------------------ // Decleration of the MCP for T0C : double z_axis_sign_T0C = 1.0; Vector pipe_mcp_position_T0C = Vector(0.0,0.0,-0.7); double pipe_radius_T0C = 0.06; // The position of each MCP at T0C: vector position_array_quartz_T0C; Array_Mcp_Quartz_Position(position_array_quartz_T0C, distance_between_quartz, heigth, pipe_mcp_position_T0C, pipe_radius_T0C); pore_position(position_array_quartz_T0C, heigth, pore_positions); //------------------------------------------------------------------------ // Decleration of the MCP for T0A : double z_axis_sign_T0A = -1.0; Vector pipe_mcp_position_T0A = Vector(0.0,0.0,3.70); double pipe_radius_T0A = 0.06; MCP* MCP_detector_T0C; MCP* MCP_detector_T0A; // The position of each Quartz MCP at T0A: vector position_array_quartz_T0A; Array_Mcp_Quartz_Position(position_array_quartz_T0A, distance_between_quartz, heigth, pipe_mcp_position_T0A, pipe_radius_T0A); pore_position(position_array_quartz_T0A, heigth, pore_positions); //----------------------------------------------------------------------------------------------------- for (unsigned int i = 0; i < position_array_quartz_T0A.size(); i++){ // Search intersection for each detectors // For T0C MCP_detector_T0C = new MCP(nameC, Mcp_dimension, position_array_quartz_T0C[i], Quartz_Dimension, number_of_sub_quartz,space_between_the_sub_quartz,Reflective_index, z_axis_sign_T0C); MCP_array_T0C.push_back(MCP_detector_T0C); // For T0A MCP_detector_T0A = new MCP(nameA, Mcp_dimension, position_array_quartz_T0A[i], Quartz_Dimension, number_of_sub_quartz,space_between_the_sub_quartz,Reflective_index, z_axis_sign_T0A); MCP_array_T0A.push_back(MCP_detector_T0A); } } ///_____________________________________________________________________________ bool Selector::Process(Long64_t entry ) { t->GetEntry(entry); if (true) { if (h->c < 3) { Printf("This is event # %d with b=%8.8ffm, and %d particles, c=%5.2f perc. ",h->event, h->b, p->GetEntries(), h->c); for (int j = 0; j < p->GetEntriesFast(); j++) { /// Loop over each particle GetEntriesFast TParticle* q = static_cast(p->At(j)); pdg = pdgDb->GetParticle(q->GetPdgCode()); if (!pdg) { Warning("Foo", "PDG (%s) %d unknown", q->GetName(), q->GetPdgCode()); continue;} if ( (q->Px() !=NAN) && (q->Py() !=NAN) && (q->Pz() !=NAN) && (q->GetMass() !=0) && (pdg->Charge() !=0) ) { Particle in = Make_Particle(q); Vector IP = in.GetVertex(); //IP for (unsigned int i = 0; i < MCP_array_T0A.size(); i++){ // Search intersection for each detectors MCP_array_T0C[i]->MCP_Intersection(in, IP, MCP_array_T0C[i], Intersection_plot_T0C, Output, pore_positions, particles_intersection_mcp,0); MCP_array_T0A[i]->MCP_Intersection(in, IP, MCP_array_T0A[i], Intersection_plot_T0A, Output, pore_positions, particles_intersection_mcp,0); } } } /// Tmaps are filled here: Q_theta(particles_intersection_mcp,2, h->c, "c", LYZ_Q, LYZ_M); particles_intersection_mcp.clear(); } p->Delete(); return true; } } ///________________________________________________________________________________________________________ void Selector::SlaveTerminate() { } ///_____________________________________________________________________________ void Selector::Terminate() { LYZ_Q = (Tmap *)fOutput->FindObject(LYZ_Q); cout << "Number is: " << LYZ_Q->GetTmap()->at(3)->at(0)<Write(); //Intersection_plot_T0C->Write(); //v2_LYZ->Write(); } #endif