//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Creation of the TBStripCluster array from TBStripHit // TBStripHitCluster are clusters from tracking detectors // of the test chamber testbench. // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Maxence Vandenbroucke TUM (original author) //.x macro/tpc/TestBench/runRecoCERN_TC.C("/nfs/hicran/project/panda/SIM/vandenbm/monitoring/clean/analysis/decoded/run-2076.001.raw_decoded.root","./",1,1000,0) // //----------------------------------------------------------- #include #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "TBStripClusterizationTask.h" ClassImp(TBStripClusterTask) TBStripClusterTask::TBStripClusterTask() : FairTask("TB Cluster Hit Task"), fpersistence(kFALSE) { fhitBranchName = "TBStripHit"; fclusterGEMBranchName = "TBGEMCluster"; fclusterSIBranchName = "TBSICluster"; alMan=NULL;//char* DETNAME[9]; DETNAME={"GM01X1__","GM01Y1__","GM02X1__","GM02Y1__","SI01X1__","SI01Y1__","SI02X1__","SI02Y1__","TC01____"};//hack for dealing with the new alignement manager } TBStripClusterTask::~TBStripClusterTask() {; } InitStatus TBStripClusterTask::Init() { //Get ROOT Manager FairRootManager* ioman= FairRootManager::Instance(); std::cout <<"TBStripClusterTask::Init()"<< std::endl; if(ioman==0) { Error("TBStripClusterTask::Init","RootManager not instantiated!"); return kERROR; } // Get input collection fhitArray=NULL; fhitArray=(TClonesArray*) ioman->GetObject(fhitBranchName); if(fhitArray==0) { Error("TBStripClusterTask::Init","Hit-array not found!"); return kERROR; } //call al manager alMan=TpcAlignmentManager::getInstance(); if (!alMan) { Error("TBStripClusterTask::Init","TpcAlignementManager not found"); return kERROR; } // create and register output array fclusterSIArray = new TClonesArray("TBSICluster"); fclusterGEMArray = new TClonesArray("TBGEMCluster"); ioman->Register(fclusterGEMBranchName.Data(),"Tpc",fclusterGEMArray,fpersistence); ioman->Register(fclusterSIBranchName.Data(),"Tpc",fclusterSIArray,fpersistence); return kSUCCESS; } void TBStripClusterTask::Exec(Option_t* opt) { bool DEBUG=false; if (DEBUG) { Long_t a = fhitArray->GetEntriesFast(); Long_t b = fhitArray->GetEntries(); Long_t c = fhitArray->GetEntriesFast(); std::cout << a << " *** " << b << " *** " << c << std::endl; if (a != c) { std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; std::cout << "**********************************************" << std::endl; exit(0); } } unsigned int nHi = fhitArray->GetEntriesFast(); if (DEBUG) { std::cout<<"TBStripClusterTask::Exec() with "<Delete(); if(fclusterSIArray==0) Fatal("TBStripClusterTask::Exec)","No SI OutputArray!"); fclusterSIArray->Delete(); int icsi = 0, icgem=0; for(unsigned int ic=0; icAt(ic); //std::cout << hi << std::endl; int detid = hi->detid(); double strip = hi->strip(); double striperr = hi->striperr(); // std::cout << detid<< "\t" <getPitch(DETNAME[detid])/10000.; //incm TVector3 uvw(strip*pitch,0,0); TVector3 xyz(alMan->localToMaster(DETNAME[detid], uvw)); // TBStripCluster( const& TVector3 posuvw, const& TVector3 posuvwErr, const& TVector3 posxyz, const& TVector3 posxyzErr, double Amp, int Det, unsigned int Size=1, TString Detname="", double Strip=0); // std::cout << "<< if(hi->detname()[0]=='S')" << hi->detname() << hi->detname()[0] << std::endl; if(hi->detname()[0]=='S')//SI { TVector3 uvwerr(pitch/sqrt(12),2.,2.); // Error : (pitch/sqrt(12),stripsize,2cm) // TVector3 xyzerr(alMan->localToMasterVect(DETNAME[detid], uvwerr)); // Error : (pitch/sqrt(12),stripsize,2cm) TVector3 xyzerr(alMan->localToMaster(DETNAME[detid], uvwerr)); // Error : (pitch/sqrt(12),stripsize,2cm) TBSICluster* cp = new ((*fclusterSIArray)[icsi++]) TBSICluster(uvw, uvwerr, xyz, xyzerr, hi->amp(), detid, hi->size(), DETNAME[detid],// hi->detname(), pitch, alMan ); } else if(hi->detname()[0]=='G')//GEM { TVector3 uvwerr(pitch/sqrt(12),10.,2.); // Error : (pitch/sqrt(12),stripsize,2cm) // TVector3 xyzerr(alMan->localToMasterVect(DETNAME[detid], uvwerr)); // Error : (pitch/sqrt(12),stripsize,2cm) TVector3 xyzerr(alMan->localToMaster(DETNAME[detid], uvwerr)); // Error : (pitch/sqrt(12),stripsize,2cm) TBGEMCluster* cp = new ((*fclusterGEMArray)[icgem++]) TBGEMCluster(uvw, uvwerr, xyz, xyzerr, hi->amp(), detid, hi->size(), DETNAME[detid],//hi->detname(), pitch, alMan ); } else std::cerr << "TBStripClusterization: ERROR, DET " << hi->detname() << " not a Silicon nor a GEM" << std::endl; } //end loop over clustersTBhit std::cout << icsi <<" SI clusters, " << icgem << "GEM clusters found" <At(i))->GetPlane(uu, vv, ww); std::cout << "SI("<< i << ")"<At(i))->GetPlane(uu, vv, ww); std::cout << "GE("<< i << ")"<