33 src_(iConfig.getParameter<edm::InputTag>(
"src")),
34 overlapAM_(iConfig.getParameter<edm::InputTag>(
"OverlapAssoMap")),
35 keepTrackStats_(iConfig.getParameter<bool>(
"keepTrackStats")),
36 keepHitPopulation_(iConfig.getParameter<bool>(
"keepHitStats")),
37 statsTreeName_(iConfig.getParameter<string>(
"TrkStatsFileName")),
38 hitsTreeName_(iConfig.getParameter<string>(
"HitStatsFileName")),
39 prescale_(iConfig.getParameter<uint32_t>(
"TrkStatsPrescale"))
58 outtree_=
new TTree(
"AlignmentTrackStats",
"Statistics of Tracks used for Alignment");
67 outtree_->Branch(
"P" ,&
P ,
"P[Ntracks]/F");
120 unsigned int trk_cnt=0;
128 for(
int k=0;
k<7;
k++){
136 for(std::vector<reco::Track>::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk; ++ittrk){
137 Eta[trk_cnt]=ittrk->eta();
138 Phi[trk_cnt]=ittrk->phi();
139 Chi2n[trk_cnt]=ittrk->normalizedChi2();
140 P[trk_cnt]=ittrk->p();
141 Pt[trk_cnt]=ittrk->pt();
142 Nhits[trk_cnt][0]=ittrk->numberOfValidHits();
160 DetHitMap::iterator mapiter;
167 hitmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
175 if(!(hitInPixel||hitInStrip)){
177 edm::LogError(
"AlignmentStats")<<
"Hit not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subDet;
183 const std::type_info &
type =
typeid(*hit);
190 inval = OverlapMap[stripclust];
194 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: "<<
className(*hit);
201 inval = OverlapMap[stripclust];
205 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: "<<
className(*hit);
215 inval = OverlapMap[pixclust];
219 edm::LogError(
"AlignmentStats")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Pixel RecHit failed! TypeId of the RecHit: "<<
className(*hit);
228 DetHitMap::iterator overlapiter;
235 overlapmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
244 Nhits[trk_cnt][subdethit]=
Nhits[trk_cnt][subdethit]+1;
267 edm::LogInfo(
"AlignmentStats")<<
"Writing out the TrackStatistics in "<<gDirectory->GetPath()<<std::endl;
275 TTree *hitstree=
new TTree(
"AlignmentHitMap",
"Maps of Hits used for Alignment");
277 unsigned int id=0,nhits=0,noverlaps=0;
278 float posX(-99999.0),posY(-77777.0),posZ(-88888.0);
279 float posEta(-6666.0),posPhi(-5555.0),posR(-4444.0);
281 unsigned int layer=0;
282 bool is2D=
false,isStereo=
false;
283 hitstree->Branch(
"DetId", &
id ,
"DetId/i");
284 hitstree->Branch(
"Nhits", &nhits ,
"Nhits/i");
285 hitstree->Branch(
"Noverlaps",&noverlaps,
"Noverlaps/i");
286 hitstree->Branch(
"SubDet", &subdet,
"SubDet/I");
287 hitstree->Branch(
"Layer", &layer,
"Layer/i");
288 hitstree->Branch(
"is2D" , &is2D,
"is2D/B");
289 hitstree->Branch(
"isStereo", &isStereo,
"isStereo/B");
290 hitstree->Branch(
"posX", &posX,
"posX/F");
291 hitstree->Branch(
"posY", &posY,
"posY/F");
292 hitstree->Branch(
"posZ", &posZ,
"posZ/F");
293 hitstree->Branch(
"posR", &posR,
"posR/F");
294 hitstree->Branch(
"posEta", &posEta,
"posEta/F");
295 hitstree->Branch(
"posPhi", &posPhi,
"posPhi/F");
315 const std::vector<Alignable*>& Detunitslist=theAliTracker->
deepComponents();
316 int ndetunits=Detunitslist.size();
317 edm::LogInfo(
"AlignmentStats")<<
"Number of DetUnits in the AlignableTracker: "<< ndetunits<<std::endl;
319 for(
int det_cnt=0;det_cnt< ndetunits;++det_cnt){
338 id=static_cast <uint32_t>( Detunitslist[det_cnt]->id() );
345 hitmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
354 overlapmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
358 posX= Detunitslist[det_cnt]->globalPosition().x();
359 posY= Detunitslist[det_cnt]->globalPosition().y();
360 posZ= Detunitslist[det_cnt]->globalPosition().z();
374 layer=pxbdet.
layer();
409 edm::LogError(
"AlignmentStats")<<
"Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subdet;
EventNumber_t event() const
bool isDoubleSide() const
bool isDoubleSide() const
#define DEFINE_FWK_MODULE(type)
Geom::Phi< T > phi() const
unsigned int wheelNumber() const
unsigned int layer() const
layer id
unsigned int layerNumber() const
uint32_t rawId() const
get the raw id
unsigned int layerNumber() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int disk() const
disk id
const TrackerGeometry * trackerGeometry_
const Alignables & deepComponents() const
std::string statsTreeName_
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
AlignmentStats(const edm::ParameterSet &iConfig)
ClusterRef const & cluster() const
static const int MAXTRKS_
std::string hitsTreeName_
bool isDoubleSide() const
ClusterRef const & cluster() const
DetId geographicalId() const
ClusterRef const & cluster() const
bool isDoubleSide() const
std::string className(const T &t)
unsigned int diskNumber() const